English 中文(简体)
TSQL: 以单词而非数字显示月份的函数
原标题:TSQL: Function to display month in words not numbers
  • 时间:2012-05-25 21:00:10
  •  标签:
  • t-sql
MONTH(CMS.App_Received_Date) as  App Month 

四月返回 4 当日期像 2012-04-01

5月份返回 5 当日期如 2012-05-02 等时, 5月份返回 5

是否有 TSQL 函数返回 4月、 5月、 6月?

i. e. MONTHNAME(CMS.App_Revived_Date)作为App月

最佳回答
DATENAME(month, CMS.App_Received_Date) as  App Month 
问题回答
SELECT  DATENAME(month,  2012-04-01 ) AS  App Month 

返回代表指定日期指定日期部分的字符串。

请注意,返回值取决于语言环境,就我而言,它返回Janwara (German)。

http://msdn.microsoft.com/en-us/library/ms174395.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms174395.aspx





相关问题
两个表格的精度

我正试图加入在服务器上的多个桌子,并保持快速业绩。

SELECT last row if USER is found

I have a log table in SQL Server. Table is structured this way: Unique ProblemID ResponsibleID AssignedToID ProblemCode 155 155 0282 4 156 155 ...

How to convert a Tsql scalar function into a table function?

I am using SSMS 2008 and I have the following scalar function to take a text string and remove all metatags from Microsoft Word. The tags are enclosed in "<...>" and there can be any number of ...

Interesting SQL query

I have this data in my table: onum amt odate cnum snum 3001 18,69 1990-03-10 00:00:00.000 2008 1007 3002 1900,10 1990-03-10 00:00:00.000 ...

热门标签