March 12, 2010 at 7:12 am
Hi experts,
i have an database date field in sql server 2005. i want to build an query to update only date against full datetime time should retain same... please show me the way asap...
thanks & Regards,
murali
March 12, 2010 at 7:35 am
declare @x datetime -- this is your date time column or variable
set @x = getdate() -- set it to current time value
select @x -- display current value
set @x = convert(char(10),@x,101) + ' 01:01:01' -- set time to a new value
select @x --display new datetime value
---- sorry, I must be dyslexic. You wanted to change the date not the time:
set @x = '2010-01-01 ' + convert(char(12),@x,114) -- set new date value, same time
select @x -- display new value
The probability of survival is inversely proportional to the angle of arrival.
March 12, 2010 at 10:53 am
Thanks Alot dude...:-)
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy