sql server - Datetime display using month name in T-SQL -


is an area that has a date type in the table. The format of this field is mm / dd / yy. Change in DD-month name-yy?

  select convert (VARCHAR, GETDATE (106)  
p> For example, "25 January 2010"

If you want your exact format, then you have a little manual feeding Required:

  Select Cast (VARCHAR as GETDATE)) + '-' + Left (DATENAME (mm, GETDATE ()), 3) + '- For example, "25-Jan-10"  

for example (CAST (VARCHAR as the year (GETDATE ()), 2)

> Update:
In fact, it is available A short way to do this is:

  SELECT REPLACE (convert (VARCHAR, GETDATE), 6), '', '-')  

Eg "25-Jan-10"


Comments