declare @id varchar(100)
set @id='1,2,3'delete tb
where stuase=0 and charindex(','+rtrim(id)+',', ','+@id+',')>0update tb set stuase=0
where stuase=1 and charindex(','+rtrim(id)+',', ','+@id+',')>0
set @id='1,2,3'delete tb
where stuase=0 and charindex(','+rtrim(id)+',', ','+@id+',')>0update tb set stuase=0
where stuase=1 and charindex(','+rtrim(id)+',', ','+@id+',')>0
解决方案 »
- SQL导入excel表格出现的问题
- SQL sever中用escape取消通配符的查询语句中需要%吗?
- 100分求助该如何写这个SQL。。。。。。
- 用c#如何查看本机下的所有SQL SERVER2008实例,谢谢
- 客户催了.....700W 的数据查询超时
- sql6.5下执行一存储过程(其中包含有事务),出现如下错误信息,应该如何处理?谢谢!!
- 用户 'sa' 登录失败。说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
- 大家帮忙看这样的语句应该怎么写?
- 请教:存储过程到底是怎么样工作的,与直接执行SQL 语句比效率上到底高在哪里?谢谢
- select 远程服务器...表名出错
- t-sql 奇怪的问题,寻找高人解决
- 一个很难的问题,关于多套BOM的读取。
@strInfo varchar(50)
as
begin
set @strInfo=@strInfo+','
declare @strId varchar(10)
WHILE CHARINDEX(',',@strInfo)>0
BEGIN
set @strId=LEFT(@strInfo,CHARINDEX(',',@strInfo)-1)
print @strId
//此处就可以些更改
SET @strInfo=STUFF(@strInfo,1,CHARINDEX(',',@strInfo),'')
end
end
exec ProcName '1,2,3'