November 15, 2006 at 12:36 pm
I need to display (and output to txt file) dates returned from a table in the format MM/DD/YYYY. The field is formatted as "datetime 8" and when queried in query analyzer displays as '1991-05-09 00:00:00.000'. Any suggestions on this would be greatly appreciated.
Thanks!
November 15, 2006 at 12:48 pm
check BO for CONVERT
Vasc
November 15, 2006 at 1:11 pm
Thanks.... already looked there. but I don't (cannot!) convert the native data in the source table.. I just need to display and output it in the manner outlined.
November 15, 2006 at 1:16 pm
How does this work for you?
SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS MMDDYYYY
OR
SELECT CONVERT(VARCHAR(10), DateCol, 101) AS DateCol from dbo.YourTable
November 15, 2006 at 1:46 pm
Ahhh.. so the "convert" does not mean it will convert the native data... .got it...
Thanks.. works great!!!
November 15, 2006 at 1:51 pm
No, only an update command can do that . You can transform the data as you wish when you select it .
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply