- SQL code
declare @sql nvarchar(4000)set @sql='Select 姓名,年,周'Select @[email protected]+',sum(case when 类型='''+类型+ ''' then Total else 0 end) As '''+类型+'''' From 表名 Group By 类型Print @sqlset @[email protected]+' From 表名 Group By 姓名,年,周'Print @sqlexecute sp_executesql @sql
以上结果如何使用report service调用
------解决方案--------------------
新建好存储过程,然后再报表工具中添加数据集(数据库的连接),在选择存储过程就行了啊