April 25, 2005 at 10:17 pm
Then you've missed a space from what I wrote. Here it is with * instead of space.
Replace(Replace(Convert(Char(6),@thedate,109),'**','0'),'*','')
The concept is that you need to find the scenario where there are 2 spaces, and put a leading zero in there. But just remove a single one.
Rob Farley
LobsterPot Solutions & Adelaide SQL Server User Group
Company: http://www.lobsterpot.com.au
Blog: http://blogs.lobsterpot.com.au
April 25, 2005 at 11:02 pm
>I cannot get Jeff's solution to work without using GETDATE().
What I wrote was meant to solve the original posting which stated... "I would like to be able to convert SQL server DateTime format to the format mmmdd."
Things like '20050101' are not SQL DateTime data types... they're text.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 26, 2005 at 3:36 am
Thanks Rob
Select Replace(Replace(Convert(Char(6),@thedate,109),'**','0'),'*','')
Works great (FYI I cut and pasted from your original post )
Mike
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply