Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何将数字转换为月份名称?_Sql_Sql Server_Vb.net - Fatal编程技术网

Sql 如何将数字转换为月份名称?

Sql 如何将数字转换为月份名称?,sql,sql-server,vb.net,Sql,Sql Server,Vb.net,在sql数据库中-月份的数据是数字(1,2,3…12)。在我的网页中,我希望它以月份名称显示(一月、二月、三月……十二月)。如何将数字转换为月份名称 VB.Net rs = db.ExecuteSelect("SELECT year,month, run_sequence, pay_code, qty, rate, amount, " & _ "convert(varchar, effective_dat

在sql数据库中-月份的数据是数字(1,2,3…12)。在我的网页中,我希望它以月份名称显示(一月、二月、三月……十二月)。如何将数字转换为月份名称

VB.Net

   rs = db.ExecuteSelect("SELECT year,month, run_sequence, pay_code, qty, rate, amount,  " & _
                                      "convert(varchar, effective_date,103) as effective_date " & _
                                      "FROM payTable WHERE id='" & id & "'", Session("CnnStr").ToString)
更新: 找到了我的解决办法

DATENAME(mm,DATEADD(mm, month-1,0))  as month

当您选择月份时,请选择DATENAME(mm,month)。

您可以根据您的月号获取三位数的月份短名称

Declare @month int 
set  @month = 1
select  Left(DateName( month , DateAdd( month , @month , -1 )),3);
DATENAME(毫米,DATEADD(毫米,月-1,0))作为月份