Monday, March 26, 2012

is there a collection of all database objects

i want to write a tool to make scripting of databases easy. the user will select the server and dababase, then they will select what they want to script: eg tables, sprocs, permissions, scheemas etc etc. currently i have a load of check boxes , one for each type of object in the db ( one for tables, one for sprocs etc). this is very long winded,and if there was a collection of the db objects i could call into a list box it would be a lot tidier and easier.

There are a number of collections within the Database object in SMO which you can use, such as Tables, Triggers, StoredProcedures, Users and Views. Each of these is a collection of the named objects within the database. (At the Server level of course, there's a Databases collection which will get you to each Database object on the server.)

Hope that helps.

sql

No comments:

Post a Comment