Using Results of sp_tables

  • I want to use the TABLE_NAME column from executing

    sp_tables @table_type = "'TABLE'"

    as a parameter to my stored procedure; is there a way to do that?

  • Can you give a bit more information on what you're trying to do?  We would be much better able to help in that case. 

    Thanks.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Sure, I have four stored procedures that create stored procedures (prMakeDeleteRecordProc, prMakeInsertRecordProc, prMakeSelectRecordProc, prMakeUpdateRecordProc)  and they each take a table name is an input parameter. I want to loop through all of my table names and execute each of the four procs for each table name.

     

  • Have you considered trying to use sp_MSforeachtable?  It's rather a bit like sp_MSforeachtable where it will loop through your tables running your command on each tablename.  sicne you have 4 procedures you'd need to run it twice, but it may save you a good bit of headache.  You can read about it here

    HTH -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Thanks Luke, works perfectly!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply