Viewing 2 posts - 1 through 2 (of 2 total)
Just add the following in the select list
(YEAR - 1) AS PreYear
June 7, 2011 at 2:14 am
#1334826
Have a similar solution using dateadd and datediff.
declare @d datetime
set @d = '2010-04-04'
update dateupdate set [date] = DATEADD(dd, DATEDIFF(dd, [date], @d), [date]) where id = 1
Regads,
http://www.ms-sql-server.com
March 12, 2010 at 7:43 am
#1132707