By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,341 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,341 IT Pros & Developers. It's quick & easy.

Passing Multiple values in stored procedure

P: 13
I need to know a way to pipe the output of an sql (select )statement to a stored procedure.
Eg:
The stored procedure is sp_rsch_filters param1,param2,param3

Requirement is to pass param1,param2 and param3 from user X.
Feb 28 '08 #1
Share this Question
Share on Google+
6 Replies


Delerna
Expert 100+
P: 1,134
Sorry I am confused
You begin by asking
I need to know a way to pipe the output of an sql (select )statement to a stored procedure.

and finish with
Requirement is to pass param1,param2 and param3 from user X.

can you clarify the question for me please?
do you want to pass a recordset or parameters?
Feb 28 '08 #2

P: 13
Sorry I am confused
You begin by asking
I need to know a way to pipe the output of an sql (select )statement to a stored procedure.

and finish with
Requirement is to pass param1,param2 and param3 from user X.

can you clarify the question for me please?
do you want to pass a recordset or parameters?
--------------------------------------------------------------------------------------------------------------------well

i want to create a stored procedure in which i pass more than one values in one
variable
Feb 28 '08 #3

Delerna
Expert 100+
P: 1,134
do you mean like this
Expand|Select|Wrap|Line Numbers
  1. exec prMyProc 'val1,val2,val3,val4'
  2.  
where the procedure is
Expand|Select|Wrap|Line Numbers
  1. CREATE PROC prMyProc @PramVar varchar(1000)
  2. AS
  3. --code to extract the values from @PramVar
  4. GO
  5.  
Feb 28 '08 #4

P: 13
do you mean like this
Expand|Select|Wrap|Line Numbers
  1. exec prMyProc 'val1,val2,val3,val4'
  2.  
where the procedure is
Expand|Select|Wrap|Line Numbers
  1. CREATE PROC prMyProc @PramVar varchar(1000)
  2. AS
  3. --code to extract the values from @PramVar
  4. GO
  5.  
-------------------------------------------------------------------------------------------------------
yes i need this

Kindly send me complete code

thanx

please send me complete o
Feb 29 '08 #5

Delerna
Expert 100+
P: 1,134
Expand|Select|Wrap|Line Numbers
  1. exec prMyProc 'val1,val2,val3,val4'
  2.  
where the procedure is

Expand|Select|Wrap|Line Numbers
  1. CREATE PROC prMyProc @PramVar varchar(1000)
  2. AS
  3.    declare @V1 varchar(10), @V2 varchar(10), @V3 varchar(10), @V4 varchar(10)
  4. set @V1= left(@Param,charindex(',',@Param)-1)
  5. set @Param= right(@Param,len(@Param)-charindex(',',@Param))
  6. set @V2= left(@Param,charindex(',',@Param)-1)
  7. set @Param= right(@Param,len(@Param)-charindex(',',@Param))
  8. set @V3= left(@Param,charindex(',',@Param)-1)
  9. set @V4= right(@Param,len(@Param)-charindex(',',@Param))
  10.  
  11. --do whatener it is that you are going to do with @V1,@V2,@V3,@V4
  12.  
  13. GO
  14.  
Feb 29 '08 #6

Delerna
Expert 100+
P: 1,134
now that I've given you that, I have a question
Why wouldn't you just do this

Expand|Select|Wrap|Line Numbers
  1. exec prMyProc val1,val2,val3,val4
  2.  
where the procedure is

Expand|Select|Wrap|Line Numbers
  1. CREATE PROC prMyProc @v1 varchar(10), @v2 varchar(10) @v3 varchar(10) @v4 varchar(10)
  2. AS
  3. --do whatener it is that you are going to do with @V1,@V2,@V3,@V4
  4.  
  5. GO
  6.  
Feb 29 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.