Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2008 SSRS不接受表类型(整数列表类型)作为参数_Sql Server 2008_Reporting Services_Ssrs 2008 - Fatal编程技术网

Sql server 2008 SSRS不接受表类型(整数列表类型)作为参数

Sql server 2008 SSRS不接受表类型(整数列表类型)作为参数,sql-server-2008,reporting-services,ssrs-2008,Sql Server 2008,Reporting Services,Ssrs 2008,我有一个存储的proc,其输入参数为integer\u list\u tbltype。我可以像这样运行程序 DECLARE @mylist integer_list_tbltype INSERT @mylist(n) VALUES(1),(2),(3),(4) exec <Proc_Name> @mylist DECLARE@mylist integer\u list\u tbltype 插入@mylist(n)值(1)、(2)、(3)、(4) exec@mylist 当我尝试在

我有一个存储的proc,其输入参数为integer\u list\u tbltype。我可以像这样运行程序

DECLARE @mylist integer_list_tbltype
INSERT @mylist(n) VALUES(1),(2),(3),(4)
exec <Proc_Name> @mylist
DECLARE@mylist integer\u list\u tbltype
插入@mylist(n)值(1)、(2)、(3)、(4)
exec@mylist
当我尝试在SSRS(Sql reporting services 2008)下将其添加为共享数据库时,会出现错误

操作数类型冲突:nvarchar与integer\u list\u tbltype不兼容

有解决办法吗


Ved

唉,SSRS中的多值参数并不像您预期的那样工作,它的行为不像表或任何类似的东西

相反,SSRS将用逗号分隔的所有值列表替换SQL查询中的参数。因此,您的示例将发送到SQL Server,如下所示:

exec <Proc_Name> 1,2,3,4
将以以下形式发送到SQL Server:

SELECT * FROM MyNumbers WHERE MyNumbers.Nmbr IN (1,2,3,4)


另外,您发布的错误消息还可能表明您的参数类型在SSRS中设置为“Text”,您的意思似乎是“Integer”。

最近我也遇到了同样的问题。我认为这是因为在实际调用报表需要运行的查询时,SSRS总是将每个参数作为nvarchar发送。SQL Server无法正确地将nvarchar解释为您尝试使用的表类型,因此会出现该错误

我刚刚在博客中介绍了一种潜在的解决方案/解决方案,在调用存储过程之前,您可以使用自定义代码块填充表变量:

SELECT * FROM MyNumbers WHERE MyNumbers.Nmbr IN (1,2,3,4)