Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
palak
Yak Posting Veteran
55 Posts |
Posted - 2008-07-15 : 15:56:50
|
| i have one question:;when select RIGHT(CONVERT(VARCHAR(9), getdate(), 6), 6) - jul 08but when i m doing select RIGHT(CONVERT(VARCHAR(9), '2006-01-01 00:00:00.000', 6), 6)OR select REPLACE(RIGHT(CONVERT(VARCHAR(9), '2006-01-01 00:00:00.000', 6), 6), '', '-') then getting - 6-01-0can u tell me i want JAN 08 means MON YYhow can i get this?thanks. |
|
|
cvipin
Yak Posting Veteran
51 Posts |
Posted - 2008-07-15 : 16:07:17
|
| Select Left(Convert(varchar, GetDate(), 7), 4) + SubString(Convert(varchar, GetDate(), 7), 9 , 2) |
 |
|
|
palak
Yak Posting Veteran
55 Posts |
Posted - 2008-07-15 : 16:13:22
|
| bit when u'll do like this:Select Left(Convert(varchar, '2008-07-15 16:10:47.340', 7), 4) + SubString(Convert(varchar, '2008-07-15 16:10:47.340', 7), 9 , 2)u'll get -200815 i want JUL 08mon yy format with not getdate any date..thanks |
 |
|
|
cvipin
Yak Posting Veteran
51 Posts |
Posted - 2008-07-15 : 16:18:24
|
| Select Left(Convert(varchar, Convert(datetime, '2008-07-15 16:10:47.340'), 7), 4) + SubString(Convert(varchar, Convert(datetime, '2008-07-15 16:10:47.340'), 7), 9 , 2) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-16 : 00:32:11
|
| Always try to do this type of formatting at your front end application.And if you reallyu want to do this in sql you can even useSelect LEFT(DATENAME(m,'2008-07-15 16:10:47.340'),3) +' '+ RIGHT(DATENAME(yyyy,'2008-07-15 16:10:47.340'),2) |
 |
|
|
|
|
|
|
|