January 7, 2009 at 5:39 am
which style do i use in convert(char(12),getdate, )
to display in dd-mmm-yyyy pattern in sql
January 7, 2009 at 5:48 am
nabajyoti.b (1/7/2009)
which style do i use in convert(char(12),getdate, )to display in dd-mmm-yyyy pattern in sql
Look up CONVERT in BOL, there's loads of detail.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
January 7, 2009 at 6:08 am
i am sorry, did not understand what BOL is?
could you please let me know the url?
January 7, 2009 at 6:11 am
nabajyoti.b (1/7/2009)
i am sorry, did not understand what BOL is?could you please let me know the url?
Books On Line, the help system for SQL Server.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
January 7, 2009 at 11:26 am
Hello since the request format is not a standard we will have to manipulate.
The query below provides the format requested
select getdate(),
cast(datepart(dd,getdate()) as varchar) + '-'+ left(convert(char(12),getdate(),9),3) +'-'+ cast(datepart(yyyy,getdate()) as varchar) RequiredFormat,
/*This is break up of how i got the required format.*/
convert(char(12),getdate(),9) 'mmm dd yyyy', datepart(dd,getdate()) dd, left(convert(char(12),getdate(),9),3) mmm, datepart(yyyy,getdate()) yyy
Hope this helps.
Thanks
---- [font="Tahoma"]Live and Let Live![/font] ----
January 7, 2009 at 11:32 am
Actually, this is easily done.
select replace(convert(varchar(11), getdate(), 113),' ','-')
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply