Hi,
How, in T-SQL, can I get my cursor to iterate throught the fields in a given table outputing the values in each field?
I'm trying to build a sp to automatically go through all my tables, then all my fields, then build a bunch of INSERT INTO mytable (myfields) VALUES (myvalues) statements so I can populate the same tables with the same data on another server.
I've used sysobjects and syscolumns so far to identify my tables and fields and I've successfully built my INSERT INTO statements (including the field list after the word INTO) but only as far as the " VALUES(" bit.
I now need to actually get the values for EVERY record in each table - a seperate INSERT INTO statement per record, per table.
Any help will be much appreciated!
How, in T-SQL, can I get my cursor to iterate throught the fields in a given table outputing the values in each field?
I'm trying to build a sp to automatically go through all my tables, then all my fields, then build a bunch of INSERT INTO mytable (myfields) VALUES (myvalues) statements so I can populate the same tables with the same data on another server.
I've used sysobjects and syscolumns so far to identify my tables and fields and I've successfully built my INSERT INTO statements (including the field list after the word INTO) but only as far as the " VALUES(" bit.
I now need to actually get the values for EVERY record in each table - a seperate INSERT INTO statement per record, per table.
Any help will be much appreciated!