如何从sql server中的DateTime字段中提取Month。
dXFactory=2021-04-22 13:12:26.000
我需要这样。
月份=四月
如何在sql server中做到这一点?
您可以使用DATENAME函数,如下所示:
SELECT DATENAME(MONTH, dXFactory)
假设dXFactory是一个日期字段
使用DATENAME
SELECT DATENAME(month,'2021-04-22 13:12:26.000') [Month Name]
或您的列名
SELECT DATENAME(month, dXFactory) [Month Name]
检查DB<gt;小提琴