Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing stored procedure OUTPUT 1

Status
Not open for further replies.

mahesh736

Programmer
Jul 20, 2001
9
US
Hi

How do we access Stored procedure output into a cursor variable?
For eg. I want to access the FKCOLUMN_NAME output given by the sp_fkeys stored procedure.

EXEC sp_fkeys @pktable_name = N'SCHOOL_DISTRICTS'
will list the foreign keys for SCHOOL_DISTRICTS table. But I want to store the FKCOLUMN_NAME output in a variable for further processing.

Mahesh
 

Create a temp table and insert the output of the SP into the table.

Create table #t (PKTABLE_QUALIFIER sysname, PKTABLE_OWNER sysname, PKTABLE_NAME sysname, PKCOLUMN_NAME sysname, FKTABLE_QUALIFIER sysname, FKTABLE_OWNER sysname, FKTABLE_NAME sysname, FKCOLUMN_NAME varchar(32), KEY_SEQ smallint, UPDATE_RULE smallint, DELETE_RULE smallint, FK_NAME sysname, PK_NAME sysname, DEFERRABILITY smallint)

Insert #t
EXEC sp_fkeys @pktable_name = N'SCHOOL_DISTRICTS'

Select * from #t

Drop table #t Terry Broadbent
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top