On Tue, May 10, 2011 at 10:54 AM, Dave Crozier <[email protected]> wrote:
> That TSQL statement doesn't in fact work as the "'01' as Datetime" needs to 
> be "'01' as Date" because the day function needs a date as a parameter not a 
> datetime.
--------------
I have this code that I wrote a long time ago.  made it through a few
leap years as well

-- setup of what could be passed in
declare @date DateTime
select @date = getdate()
-- run this as the code
select  dateadd(d , day(@date)*-1,  dateadd(m,1,@date) )

YMMV

-- 
Stephen Russell

Unified Health Services
60 Germantown Court
Suite 220
Cordova, TN 38018

Telephone: 888.510.2667

901.246-0159 cell

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to