|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, February 01, 2011 3:44 AM
Points: 0,
Visits: 7
|
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 7:26 PM
Points: 254,
Visits: 277
|
|
Alternatively, replace all the date calc code with:
select @qdt=dateadd(m,-1,dateadd(d,datediff(d,'1 Jan 1900',getdate()),'1 Jan 1900')-datepart(d,getdate())+1)
This returns the first day of the previous month, 12:00 am, as does the given script.
An explanation of what the code was doing would have been nice, rather than having to work it out. However, the majority is not needed as SQL provides all the necessary functions for doing date calcs...
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, October 30, 2012 1:27 AM
Points: 1,
Visits: 61
|
|
|
|
|