[dba-SQLServer]Why Year 2001?

Nicholson, Karen knicholson at gpsx.net
Wed Sep 24 11:52:30 CDT 2003


I am trying to get day 1 of the prior month, or August 1, 2003

-----Original Message-----
From: Brophy, Christopher [mailto:Christopher.Brophy at GDC4S.Com]
Sent: Wednesday, September 24, 2003 11:43 AM
To: 'dba-sqlserver at databaseadvisors.com'
Subject: RE: [dba-SQLServer]Why Year 2001?


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
_______________________________________________
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