SriChary
asked on
Update Year of Datefield column with 2008 in MS SQL
Hi,
I have this Date Field in my table in DATETIME datatype and I would like to update the year with 2008 of the entire table.
I tried this but it did not work
Update Productivity
set RecCreateDate="2008"
where RecCreateDate is not null
It gave an Error.
Could you please give me a correct SQL statement for this
I have this Date Field in my table in DATETIME datatype and I would like to update the year with 2008 of the entire table.
I tried this but it did not work
Update Productivity
set RecCreateDate="2008"
where RecCreateDate is not null
It gave an Error.
Could you please give me a correct SQL statement for this
ASKER
Hi tbsgadi,
Yes DateTime datatype holds a whole date and I want to update just the year in it.
For eg: If I have a date "01/15/2003"
I want to update it to "01/15/2008"
Any options please.
Thanks
Yes DateTime datatype holds a whole date and I want to update just the year in it.
For eg: If I have a date "01/15/2003"
I want to update it to "01/15/2008"
Any options please.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DATETIME datatype holds a whole date like 1/1/2008 not just the year.
Gary