October 28, 2008 at 3:27 am
Hi all, I have been looking at a number of methods for converting dates and haven't found an answer to the format I need...
I have values in date time format, 01/01/2008 10:00:00 and I need them to return Oct-08... Can anyone help?
October 28, 2008 at 3:49 am
I have found a crude method of archiving this...
SELECTLEFT(CONVERT(NVARCHAR, datWork_dtDate_Received, 107),3) + '-' + RIGHT(CONVERT(NVARCHAR, datWork_dtDate_Received, 107),2) As datWork_dtDate_Received
October 28, 2008 at 5:34 am
You basically have it. TSQL isn't the best place to worry about formatting data. Convert is a pretty good method. But if you really need to break it down, take a look at the DATENAME function.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply