Wednesday, March 7, 2012

Reproducable crash

I have submitted this bug to microsoft connect, but I thought I would add it here to further the discussion. Here is how to reproduce it in the most simplest of terms by using a calculated date search on a date field:

/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
CREATE TABLE dbo.Table_1
(
t_id nchar(10) NULL,
t_date smalldatetime NULL
) ON [PRIMARY]
GO
COMMIT

SELECT
t_id, t_date
FROM Table_1
WHERE t_date >= DATEADD(dd,-7,DATEADD(dd, DATEDIFF(dd,0,getdate()), 0)) AND t_date <= DATEADD(ss,-1,DATEADD(dd,1,DATEADD(dd, DATEDIFF(dd,0,getdate()), 0)))
GROUP BY t_id, t_date
Thanks for reporting this.

I've opened a bug to track this.

Thanks,

No comments:

Post a Comment