在SQL server management 里查的
select ISNULL(convert(nvarchar(20),datepart(year,tdate)),'未设定') as 年度,count(*) from tb
group by datepart(year,tdate)结果:
未?定 0
2013 0
怎么解决
select ISNULL(convert(nvarchar(20),datepart(year,tdate)),'未设定') as 年度,count(*) from tb
group by datepart(year,tdate)结果:
未?定 0
2013 0
怎么解决
group by datepart(year,tdate)
count(*)
from tb
group by datepart(year,tdate)
--或者这样,修改排序规则
select ISNULL(convert(nvarchar(20),datepart(year,tdate)),'未设定' collate Chinese_PRC_CI_AS) as 年度,
count(*)
from tb
group by datepart(year,tdate)