日期:2014-05-17 浏览次数:20509 次
ALTER PROCEDURE [dbo].[存储过程名]
@id_check nvarchar(max)
AS
BEGIN
XXOO省略
END
ALTER PROCEDURE [dbo].[存储过程名]
@id_check nvarchar(max)
AS
BEGIN
DECLARE @idgroup nvarchar(max) --这里定义一个新的变量
SET @idgroup=replace(@id_check,XXOO不会写) --这里去掉单引号后赋值给新变量
XXOO省略
END
ALTER PROCEDURE [dbo].[存储过程名]
@id_check nvarchar(max)
AS
BEGIN
update a
set a.mark = 2
from 表table a join (
select substring(@id_check,number,charindex(',',@id_check+',',number)-number) as colforID
from master..spt_values
where [type] = 'P' and number <= len(@id_check+',')
and charindex(@id_check,@id_check+',',number) = number
)b on a.id = b.colforID
END
declare @id_check nvarchar(max) --你的参数
declare @sql varchar(max)
set @sql='select * from tablename where id in ('+@id_chenk+')'
exec (@sql)