Converting SQL Month from numerical to full written form
the following bit of SQL pulls through the month a marriage took place numerically, but i need to display the full written name of the month.... any ideas?
(SELECT RIGHT('00'+CAST(MONTH(MARDATE) AS VARCHAR),2)
FROM M开发者_如何学运维atterDataDef
WHERE ptMatter = $Matter$)
Note - it might be microsoft sql server, but i'm not au fait with SQL
Use the datename function, if it's SQL Server:
You con't need your concatenation '00'+
or cast
(assuming mardate
is a datetime).
select datename(month, MARDATE)
from ....
This shold execute without error.
EDIT Edited the above code. You don't need the 'month()' conversion.
精彩评论