--在存储过程中where条件in()的替代做法DECLARE @test NVARCHAR(50)SET @test='48,49,50,51';SELECT * FROM dbo.TbExamRecord WHERE CHARINDEX(','+CAST(reid AS NVARCHAR(10))+',',','+@test+',')>0--等同于SELECT * FROM dbo.TbExamRecord WHERE REID IN(48,49,50,51)
本文共 302 字,大约阅读时间需要 1 分钟。
--在存储过程中where条件in()的替代做法DECLARE @test NVARCHAR(50)SET @test='48,49,50,51';SELECT * FROM dbo.TbExamRecord WHERE CHARINDEX(','+CAST(reid AS NVARCHAR(10))+',',','+@test+',')>0--等同于SELECT * FROM dbo.TbExamRecord WHERE REID IN(48,49,50,51)
转载于:https://www.cnblogs.com/abenmao/archive/2012/05/28/2521593.html