Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update statement

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2010-09-29 : 00:24:28
Hi,

I need to update date field column where i need to update only year.
example : 01-01-2000 to 01-01-2010 instead of whole i need to update only year

Thanks,
Gangadhar

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-09-29 : 00:29:34
You can use dateadd function and add the years.

Example:
Update Yourtable set ColumnToUpdate = Dateadd(yy,10,ColumnToUpdate)
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2010-09-29 : 01:02:22
Thankx
Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-09-29 : 01:55:15
You are welcome
Go to Top of Page
   

- Advertisement -