Click here to Skip to main content
12,552,952 members (55,266 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL
hello all,

I have pass comma separated parametor to Stored procedure but i don't get result,


and I have replace it in SP like

tof.case_status in(convert(varchar(max),@status_code))

but i don't get result,

please tell me where i am wrong
Posted 28-Nov-12 2:27am
joshrduncan2012 28-Nov-12 9:02am
What result are you getting and what should you be getting? Can we see more of your code to get an idea of the context of how this is implemented? We can't assume anything based on what you have shown us already.
Maksud Saifullah Pulak 28-Nov-12 14:44pm
What result you are getting now?
Mathlab 28-Nov-12 17:27pm
have you ever heard of a subquery?
Madhuri Patil 29-Nov-12 2:31am
Hey ,guys I have solved this problem.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Basic information, you'll find here:[^]

Below, example code should works:
CREATE TABLE #tof(case_status INT)
INSERT INTO #tof(case_status)
INSERT INTO #tof(case_status)
INSERT INTO #tof(case_status)
INSERT INTO #tof(case_status)
INSERT INTO #tof(case_status)
DECLARE @status_code NVARCHAR(300)
DECLARE @sql_query NVARCHAR(300)
SET @status_code='1, 2'
SET @sql_query = 'SELECT * ' +
                'FROM #tof ' +
                'WHERE case_status IN (' + @status_code + ')'
EXEC (@sql_query)
Madhuri Patil 29-Nov-12 2:33am
thanks buddy,
I have apply same as your solution only the littlebit difference,in mine and your solution.but thanks.
Madhuri Patil 29-Nov-12 4:01am
I have solve this problem for varchar,I have the problem in,
my parametor is varchar and DB type is Int so what i do in that case,
actually I have cast it but it throw conversion error.
Maciej Los 29-Nov-12 14:18pm
Madhuri Patil 30-Nov-12 0:42am
And... what do you mean sir... I don't understand
I am telling you my problem,but anyway I have solved it.
Maciej Los 30-Nov-12 12:43pm
Thank you ;)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100