Populating tables. | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Populating tables.

I need to populate all tables in my database. There are around 100 tables in the database with a lot of constraints. Data for some tables are derived from a combination of tables from other database using views and joins. For populating tables, we need to populate the master table first then the child table. Is there any way how we can generate/write a script so that the tables can be populated in order, otherwise it will throw constraint errors. Thanks, StarWarsBigBang
If you want to pupulate all table in the database…
Then why don’t you use backup/restore method…
Restore the database and remove unwanted objects from the db… MohammedU.
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

table names at the destination database have a different name, although they have the same fields and constraints. Data for some tables, as I mentioned above are derived from the source database using joins as that table structure may not be the same. I just need to know if there is any way to know the sequence in which the tables should be populated. Thanks, StarWarsBigBang
Before you have actually tried that or know the order? I’m tempted to say no. No solution I’m currently aware of, but trial and error. —
Frank Kalis
Microsoft SQL Server MVP