Reputation: 289
is there a way I can write a script to find all tables with a given filter (e.g. all tables that start with "tbl_") and copy them (structure only) but adding a new standard column to each one?
I'm using SQL server 2008.
Thanks in advance.
Upvotes: 1
Views: 666
Reputation: 89651
Yes
Use the Metadata: INFORMATION_SCHEMA.TABLES, INFORMATION_SCHEMA.COLUMNS
Generate table creation scripts in a different schema or database or table name with the additional columns
Upvotes: 1