[dba-SQLServer]Why Year 2001?

Brophy, Christopher Christopher.Brophy at GDC4S.Com
Wed Sep 24 10:42:42 CDT 2003


You are using the datepart result (today is the day 24) and subtracting that
many months from now (2003/09) less one more to get a date in 2001/08.

Not sure what you are trying to accomplish.

Chris

-----Original Message-----
From: Nicholson, Karen [mailto:knicholson at gpsx.net]
Sent: Wednesday, September 24, 2003 12:37 PM
To: Dba-Sqlserver (E-mail)
Subject: [dba-SQLServer]Why Year 2001?


What part of this is telling it to extract the year 2001 instead of 2003?

select DATEADD(mm,
DATEDIFF(mm,0,dateadd(mm,-1-datepart(day,getdate()),getdate())),0)
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


More information about the dba-SQLServer mailing list