当您尝试创建MS SQL Server 2008上的这个proc和尝试绑定的报告(水晶或SQL Server报表)你不能从报告中的任何参数的一部分。我没有得到任何错误。我只看到PROC名称并没有列在它从它那里得到任何数据。请帮助无法绑定凡在SQL查询
create proc getdata
@where as nvarchar (max)
as
declare @sql as varchar(max)
set @sql='select cp.address,
(case when cp.male =1 then ''Male''
when cp.female =1 then ''Female''
else null end) AS "Gender"
from consumer_premium cp where '+ @where
exec(@sql);
@where例如执行
getdata 'male=1'
这就是表
CREATE TABLE [dbo].[Consumer_Premium](
[Address] [nvarchar](255) NULL,
[Male] [bit] NULL,
[Female] [bit] NULL)
请帮助。
[报告时SQL查询问题]的可能重复(HTTP:/ /stackoverflow.com/questions/6520506/sql-query-problem-when-reporting) – MatBailie
语法错误:无法将“u”转换为任何有意义的内容 –