I have the date in the SQL server column as 2002-06-16 00:00:00.000 and I will be needing this to convert to 2003-06-16 00:00:00.000. Just the year from 2002 to 2003. I used an update statement like
UPDATE dbo.tableA
SET Datepart (yyyy,TranDt) = Datepart (2003,TranDt)
This did not work - is there anything I need to change in the update statement to make this query do what I want to -
Thanks!run this for an example
select DATEADD(yyyy, 1, getdate())
update x
set x.timefield = DATEADD(yyyy, 1, x.timefield)
from table x|||mkkmg,
Thanks a million it worked perfect!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment