|
Posted by Ray via SQLMonster.com on 07/21/05 01:20
Ross,
Thank you so much ....
Ross Presser wrote:
>> Hi there,
>>
>[quoted text clipped - 8 lines]
>>
>> Regards,
>
>declare @d1 smalldatetime
>declare @d2 smalldatetime
>declare @d3 smalldatetime
>
>-- @d1 is the input date
>set @d1 = CURRENT_TIMESTAMP
>-- truncate hours, min, etc.
>set @d1 = convert(smalldatetime, floor(convert(float, @d1)))
>
>-- @d2 - last day of previous month
>
>set @d2 = dateadd(day, - datepart(day, @d1), @d1)
>
>-- @d3 - first day of previous month
>
>set @d3 = dateadd(day, - datepart(day, @d2) + 1, @d2)
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-general/200507/1
Navigation:
[Reply to this message]
|