Something Sort或Filter..iguess

时间:2017-04-03 01:40:32

标签: c# sql stored-procedures reportviewer

你可以帮助我吗,因为我想在报告查看器上显示没有记录或插入数据的日期........例如.. MARCH 2,3,5,7有记录..我想要在没有记录的报告查看器上显示MARCH 4,6 .....类似的东西。 enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用此代码来构建日历,然后只需将日历加入表格

即可
declare @mm varchar(2) = '02'
declare @yy varchar(4) = '2017'


select cast(@yy + '-' + @mm + '-' + cast(x.dd as varchar(2)) as date)
 from  
(select number [dd] from master..spt_values 
where type = 'p' 
and number between 1 and 31
) x 
where  isdate(cast(@yy + '-' + @mm + '-' + cast(x.dd as varchar(2)) as varchar(max))) = 1
order by x.dd