Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
In stored procedure we need to get rows which column have passed values.

I am used where column in (@cid)
This column type is integer , I am passed values by delimiter comma.
how can split and code in single line

I used where cast(columnname,varchar(50)) in (@custid). but getting no result.


.
Posted

1 solution

You need not split the values here. you can use dynamic SQL to fetch the data.


Eg:

EXEC('Select * from tablename where Id in('+@cid+')')



Please try this and let me know if you have any issues.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900