开发者

Converting SQL Month from numerical to full written form

开发者 https://www.devze.com 2023-02-04 13:06 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消