当前位置:网站首页>Sqlserver stored procedures pass array parameters

Sqlserver stored procedures pass array parameters

2022-07-05 04:50:00 Cup dissatisfaction

Problem description

Create PROCEDURE  [dbo].[Ly_Kc_GetKcInfoById] 
    @strKcId varchar(500)-- The value to be passed in is ‘1,2,3,4,5’

select * from Table where Id in (@strKcId ) 

explain Id by Int type

The parameter ‘1,2,3,4,5’ Pass it on , Executing a stored procedure will report an error .

terms of settlement :

select   *   from Table   where CHARINDEX(','+cast(Id as varchar(20))+','  ,  ','[email protected]+',')>0

原网站

版权声明
本文为[Cup dissatisfaction]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050445296556.html