Get result from stored procedure

I have a stored process A containing stored proc B.

stored proc B inserts and returns a string of information.

is there a way to access this information in stored procedure A?

+3
source share
3 answers

You can execute the stored procedure and select it in the temp table.

Create #table ()....

INSERT INTO #table EXEC your_procedure

The only time it really becomes difficult (and possibly impossible, I never saw it) is when the stored procedure returns several sets of records (rather than several records), and the records have different fields.

EDIT: You can also use the table variable ( DECLARE @my_table TABLE()) to do the same. In your situation, you will want to try and see which is better.

http://www.sql-server-performance.com/2007/temp-tables-vs-variables/

+2

, -exec .

Insert-Exec.

+1

I recommend that you create Table variableand insert string information into it

EDIT:

Please note that this will be useful if not in the "Transaction" section, and not join it with other tables and just act as an intermediate for storing row information, as you just said in the request.

0
source

All Articles