I have a number of tables that have the same structure, i.e., ID and Name, where ID is the primary key and name is a varchar column. I want to create a common stored proc that returns these fields, where the differences are the name of the table and the column names. I'm using a Cursor to read the tables. So, I'd like to have one proc call another proc - and either have the calling proc create the cursor and pass it along, or have the calling proc create the SQL and pass it along and then the called proc would create the cursor.
The called proc does some data manipulation and populates a temp table.
I cannot get either way to work, as I get syntax errors. Any ideas?