Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using SMO to Create Table scripts with Dependencies

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
0
0
Here is my situation. I have a table which has 1 column. This column contains the table names I need scripted out to their own individual sql files. Via a SSIS package, I loop through each row and create a table script with dependencies set to true. That all works great.

Here is my dilemna. If the withdependencies option is set to true, it scripts out the table "tblCodes" along with a create script for "tblCodesTypes" in the same script...Perfect, this is what I want.

However, when the loop comes back through again, it wants to create another script for "tblCodesTypes"...this is bad. How do I avoid this? The table script name in this scenario would be "tblCodes.sql" which would contain create scripts for both tables.
 
Sounds like you'll need to populate some sort of work table with the names of tables whose scripts are already generated. Check the table for the name of the current table being addressed, and skip it if it's there.

-------++NO CARRIER++-------
 
I was reading up o dependency trees with smo...that may be my answer...thanks for repoonding.
 
Let us know how you resolve your issue.

tks

-------++NO CARRIER++-------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top