April 6, 2015 at 2:10 pm
Select '"' + CAST( GETDATE() as varchar(100) ) + '"' as Obs_dt_1
I get this output---> "Apr 6 2015 4:07PM"
But what I really need is for it to show in this format---> "2015-04-06 16:08:05.317"
How do I do the select ?
April 6, 2015 at 2:13 pm
convert has an optional 3rd parameter:
--2015-04-06 16:13:21.187
SELECT CONVERT(VARCHAR,getdate(),121)
Lowell
April 6, 2015 at 3:15 pm
Thx, it worked.
However when I paste the results in EXCEL the entire string got converted to some numbers ...
Hmm that is outside of this forum but a reply would be appreciated.
April 6, 2015 at 3:24 pm
mw112009 (4/6/2015)
Thx, it worked.However when I paste the results in EXCEL the entire string got converted to some numbers ...
Hmm that is outside of this forum but a reply would be appreciated.
The short answer is that excel sucks and likes to try autoformat data, usually in very bad ways.
What you can do is change all the cells in your excel sheet to text that should stop excel from trashing the data.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply