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 需要创建过程以输入多个数据_Sql_Sql Server 2008 - Fatal编程技术网

Sql 需要创建过程以输入多个数据

Sql 需要创建过程以输入多个数据,sql,sql-server-2008,Sql,Sql Server 2008,我创建了1个程序,通过SSRS报告更新1个表。 和在报告中一样,用户将输入数据,通过这些数据更新表。我面临的唯一问题是我不能同时输入多个数字 我有一个这样的程序 create procedure [dbo].[updating1] @up int as update test1 set Lotid=0 where Lotid=@up GO 我必须进行哪些更改,以便可以同时输入多个数字。 谢谢 更改您的过程以接受表类型作为输入参数。使用表格类型参数,您可

我创建了1个程序,通过SSRS报告更新1个表。 和在报告中一样,用户将输入数据,通过这些数据更新表。我面临的唯一问题是我不能同时输入多个数字

我有一个这样的程序

   create procedure [dbo].[updating1] @up int  
   as  
   update test1 set Lotid=0
   where Lotid=@up  
   GO
我必须进行哪些更改,以便可以同时输入多个数字。

谢谢

更改您的过程以接受表类型作为输入参数。使用表格类型参数,您可以传递多个
Lotid
作为输入并更新表格

创建用户定义的表类型

Create type udt_Lotid table (up int)
更改您的过程以接受udt作为输入以及更新查询中的相关更改

Alter procedure [dbo].[updating1] (@up udt_Lotid READONLY)
as 
update T1 set Lotid=0
From test1 T1 
Join @up t 
  on t.up = t1.up

我无法创建用户定义的表类型。表附近出现语法错误