tags:

views:

36

answers:

1

Hi, 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.

A: 

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

Cade Roux
Thank you - that was enough to help me find a more detailed answer here: http://social.msdn.microsoft.com/Forums/en/transactsql/thread/c7f4e2ee-f871-4ebf-868c-2c1f8a8fd2dd
Mikalee