Tuesday, October 26, 2010

What will be the output of below query?

DECLARE @Date datetime
SET @Date = '2010-01-31'
SELECT DATEADD(MONTH,-3,DATEADD(MONTH, 3, '31-Jan-2010')) AS [Date]

1. 2010-01-31 00:00:00.000
2. 2010-01-30 00:00:00.000
3. 2010-02-01 00:00:00.000
4. This will throw an error.
5. None of the above.




Answer
2. 2010-01-30 00:00:00.000

No comments:

Post a Comment