Click here to Skip to main content
15,942,847 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
how to convert comma separated value in stored procedure in sql server


In
SQL
stored procedure

i have a input parameter values like this 1,2,3,5...


but i need to do in query in filter condition WHERE clause ('1','2','3','5',)


Plz can any one help me to do this
Posted

Prior to postig the question here, have you tried searching the same in Google?

I am sure you'll need
(1,2,3,5)

rather than
('1','2','3','5',)

The comma at the end doesn't make any sense and will result in syntax error.

There are few ways through which you can do this.
Check these articles-
Using comma separated value parameter strings in SQL IN clauses[^]
Passing a varchar full of comma delimited values to a SQL Server IN function[^]

Pass comma separated (delimited) values as Parameter to Stored Procedure in SQL Server
[^]

Hope, it helps :)
 
Share this answer
 
can any one plz help me

C#
i have a input parameter values like this 1,2,3,5...


but i need to do in query in filter condition WHERE clause ('1','2','3','5') 
 
Share this answer
 
Comments
CHill60 2-Dec-15 8:43am    
This is not a solution. Have you looked at the articles on the links that @Suvendu Shekhar Giri gave you? The first one will show you what to do.

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