Oct 24, 2002 #1 sarav2k Technical User Joined Oct 22, 2002 Messages 42 Location US Hi I would like to execute system stored procedure(eg. sp_columns)from another stored procedure and want to get the record set for analysis. will cursor be useful for this? How to do it? Thanks in advance sarav
Hi I would like to execute system stored procedure(eg. sp_columns)from another stored procedure and want to get the record set for analysis. will cursor be useful for this? How to do it? Thanks in advance sarav
Oct 24, 2002 #2 JJayUK Programmer Joined Dec 18, 2001 Messages 57 Location GB Most system stored procedures that return recordsets can be invoked as part of an INSERT statement. CREATE TABLE #DATA ( DATA CHAR(500) ) INSERT #DATA EXEC master..xp_cmdshell('DIR *.*') Will load the results of the DIR *.* operation into the table called #DATA. I don't see why you cannot do this with the other ones as long as they provide output. Hope this helps Regards, JJayUK Upvote 0 Downvote
Most system stored procedures that return recordsets can be invoked as part of an INSERT statement. CREATE TABLE #DATA ( DATA CHAR(500) ) INSERT #DATA EXEC master..xp_cmdshell('DIR *.*') Will load the results of the DIR *.* operation into the table called #DATA. I don't see why you cannot do this with the other ones as long as they provide output. Hope this helps Regards, JJayUK
Oct 24, 2002 Thread starter #3 sarav2k Technical User Joined Oct 22, 2002 Messages 42 Location US JJayUK... It is giving output.... but Now my question is. Do we need to create the temp table with all the columns to match the executed SP? Is that only way ? or Any other way? Thanks Sarav2k Upvote 0 Downvote
JJayUK... It is giving output.... but Now my question is. Do we need to create the temp table with all the columns to match the executed SP? Is that only way ? or Any other way? Thanks Sarav2k