Tuesday, March 20, 2012

Automatic script out database objects to file

Hi champs,

It is possible to script the databases , tables and all other objects, out to a SQL file.

Is there a way to control this with a script?

For instance, want to run a script that schripts only all the tables out to a result -SQL script.

Or a script that scripts out all the constraints and user defined variables to a SQL result script.

Is this possible to do in a SQL script?

/Many thanks

YOu can use the SMO classes for that with iterating through the information of the object collections, but you can′t do that in TSQL easily.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment