Calling a stored procedure with parameters from another stored procedure 
Author Message
 Calling a stored procedure with parameters from another stored procedure
How can I call a stored procedure that has parameters from another stored
procedure?

What we want to do is use the result set from a stored procedure with
further criteria.  Doing something like this (excuse me if this is way off,
I'm new at this): SELECT * from spTest '11' WHERE job = '993039' does not
work.  Can something like this be done (I realize it might have to be done a
completely different way).

TIA!
Jody



Sat, 23 Mar 2002 03:00:00 GMT
 Calling a stored procedure with parameters from another stored procedure

I can suggest two options:

Create a temporary table and use INSERT INTO #temp_table EXEC sp... to fill
it with the sp's output, then further manipulate it.

Use the OPENROWSET function to connect to your own server. This function can
execute a sp and return a rowset as its output:

SELECT a.*
FROM OPENROWSET('SQLOLEDB','server';'user';'pass','EXEC sp...') AS a
WHERE a.col1 = ...

--
Itzik Ben-Gan MCSE+I, MCSD, M(-:DBA, MCT, SQL Server MVP

Hi-Tech College, ISRAEL.

"Wisdom is putting knowledge into action."
Bubishi


Quote:
> How can I call a stored procedure that has parameters from another stored
> procedure?

> What we want to do is use the result set from a stored procedure with
> further criteria.  Doing something like this (excuse me if this is way
off,
> I'm new at this): SELECT * from spTest '11' WHERE job = '993039' does not
> work.  Can something like this be done (I realize it might have to be done
a
> completely different way).

> TIA!
> Jody



Sat, 23 Mar 2002 03:00:00 GMT
 Calling a stored procedure with parameters from another stored procedure
Thank you!!!!!!!!!!  This is exactly what we needed.  I was afraid that I
didn't explain it good.

Quote:

>I can suggest two options:

>Create a temporary table and use INSERT INTO #temp_table EXEC sp... to fill
>it with the sp's output, then further manipulate it.

>Use the OPENROWSET function to connect to your own server. This function
can
>execute a sp and return a rowset as its output:

>SELECT a.*
>FROM OPENROWSET('SQLOLEDB','server';'user';'pass','EXEC sp...') AS a
>WHERE a.col1 = ...

>--
>Itzik Ben-Gan MCSE+I, MCSD, M(-:DBA, MCT, SQL Server MVP

>Hi-Tech College, ISRAEL.

>"Wisdom is putting knowledge into action."
>Bubishi



>> How can I call a stored procedure that has parameters from another stored
>> procedure?

>> What we want to do is use the result set from a stored procedure with
>> further criteria.  Doing something like this (excuse me if this is way
>off,
>> I'm new at this): SELECT * from spTest '11' WHERE job = '993039' does not
>> work.  Can something like this be done (I realize it might have to be
done
>a
>> completely different way).

>> TIA!
>> Jody



Sat, 23 Mar 2002 03:00:00 GMT
 Calling a stored procedure with parameters from another stored procedure
Thank you!!!!!!!!!!  This is exactly what we needed.  I was afraid that I
didn't explain it good.

Quote:

>I can suggest two options:

>Create a temporary table and use INSERT INTO #temp_table EXEC sp... to fill
>it with the sp's output, then further manipulate it.

>Use the OPENROWSET function to connect to your own server. This function
can
>execute a sp and return a rowset as its output:

>SELECT a.*
>FROM OPENROWSET('SQLOLEDB','server';'user';'pass','EXEC sp...') AS a
>WHERE a.col1 = ...

>--
>Itzik Ben-Gan MCSE+I, MCSD, M(-:DBA, MCT, SQL Server MVP

>Hi-Tech College, ISRAEL.

>"Wisdom is putting knowledge into action."
>Bubishi



>> How can I call a stored procedure that has parameters from another stored
>> procedure?

>> What we want to do is use the result set from a stored procedure with
>> further criteria.  Doing something like this (excuse me if this is way
>off,
>> I'm new at this): SELECT * from spTest '11' WHERE job = '993039' does not
>> work.  Can something like this be done (I realize it might have to be
done
>a
>> completely different way).

>> TIA!
>> Jody



Sat, 23 Mar 2002 03:00:00 GMT
 Calling a stored procedure with parameters from another stored procedure
I agree with u, but.... what about openrowset... it's faster????, have u
tried it...??/



Quote:
> I think the best way is to create a temp table, insert results of stored
> procedure into table, and query table. e.g.;

> Create table #temp(job int, ... )

> Insert #temp exec sp_test 11

> Select * from #temp where job=

> HTH

> Josh



> > How can I call a stored procedure that has parameters from another
stored
> > procedure?

> > What we want to do is use the result set from a stored procedure with
> > further criteria.  Doing something like this (excuse me if this is way
> off,
> > I'm new at this): SELECT * from spTest '11' WHERE job = '993039' does
not
> > work.  Can something like this be done (I realize it might have to be
done
> a
> > completely different way).

> > TIA!
> > Jody



Sat, 23 Mar 2002 03:00:00 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. Calling a stored procedure with parameters from another stored procedure

2. Error at obtaining output parameters of the stored procedure, calling other stored procedure

3. Calling Stored Procedure that calls Stored Procedure in ASP

4. Calling a Java Stored Procedure from another Java Stored Stored Procedure

5. temporary tables in stored procedures/parameter views vs stored procedures

6. ado recordsets from stored procedures, stored procedures have input parameters

7. output parameters stored procedures / extended stored procedures

8. ado recordsets from stored procedures, stored procedures have input parameters

9. Stored Procedure calling Stored Procedure

10. Call a stored procedure from another stored procedure

11. Calling a Stored Procedure from a Stored Procedure

12. How to call an Oracle Stored procedure from MSSQL Server Stored Procedure


 
Powered by phpBB® Forum Software