日期:2014-05-17 浏览次数:20392 次
create proc proc_test @ids varchar(2000)
as
set nocount on
update A set bo = 1
where charindex(','+cast(id as varchar)+',',','+@ids+',')>0
go
--执行
declare @ids varchar(2000)
set @ids='1,2,5,6'
exec proc_test @ids
create proc proc_test
@ids varchar(max)
AS
BEGIN
set @ids='update A set bo = 1 where id in ('+@ids+')'
EXEC(@ids)
END
go
--执行
declare @ids varchar(max)
set @ids='1,2,5,6'
exec proc_test @ids