1

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you - that was enough to help me find a more detailed answer here: social.msdn.microsoft.com/Forums/en/transactsql/thread/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.