Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2006-11-10 : 08:34:03
|
I have the backups and our tables are owned byTC_0002TC_0004TC_0008I only need to restore TC_0002 from the backup....I cannot think of a way within restoring the entire bak somewhere and then writing scripts to takeRESTOREDDB delete from ORIGNALDB.TC_0002.TABLENAME INSERT INTO ORIGNALDB.TC_0002.TABLENAME select from RESTOREDB.TC_0002.TABLENAMEBut then i run into which one first because of relationships etc....Any suggestions |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2006-11-10 : 12:56:38
|
Just concerned now with parent and child.Is there a way to remove the FK and then put back after with a script.so there are no parent and child relationship just purely single tables.I think there are triggers on there too....Thanks |
 |
|
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2006-11-10 : 13:05:58
|
just looked at the script.i ran it against northwindLoad tables for database Northwind(15 row(s) affected)Load PK/FK references(13 row(s) affected)Make copy of PK/FK references(13 row(s) affected)Load un-referenced tables as level 0(2 row(s) affected)Remove self references(1 row(s) affected)Delete lower level references(0 row(s) affected)Load level 1 tables(7 row(s) affected)Delete lower level references(9 row(s) affected)Load level 2 tables(4 row(s) affected)Delete lower level references(3 row(s) affected)Load level 3 tables(2 row(s) affected)Done loading table levels Count of Tables by level REF_LEVEL TABLE_COUNT ----------- ----------- 0 21 72 43 2(4 row(s) affected)Tables in order by level and table nameNote: Null REF_LEVEL nay indicate possible circular reference REF_LEVEL TABLE_NAME ----------- ---------------------------------------- 0 dbo.ACTUAL_HOURS0 dbo.Pivot1 dbo.Categories1 dbo.CustomerDemographics1 dbo.Customers1 dbo.Employees1 dbo.Region1 dbo.Shippers1 dbo.Suppliers2 dbo.CustomerCustomerDemo2 dbo.Orders2 dbo.Products2 dbo.Territories3 dbo.EmployeeTerritories3 dbo.Order Details(15 row(s) affected)Tables and Referencing Tables REF_LEVEL TABLE_NAME REFERENCING_TABLE ----------- ---------------------------------------- ---------------------------------------- 0 dbo.ACTUAL_HOURS NULL1 dbo.Categories dbo.Products2 dbo.CustomerCustomerDemo NULL1 dbo.CustomerDemographics dbo.CustomerCustomerDemo1 dbo.Customers dbo.CustomerCustomerDemo1 dbo.Customers dbo.Orders1 dbo.Employees dbo.Employees1 dbo.Employees dbo.EmployeeTerritories1 dbo.Employees dbo.Orders3 dbo.EmployeeTerritories NULL3 dbo.Order Details NULL2 dbo.Orders dbo.Order Details0 dbo.Pivot NULL2 dbo.Products dbo.Order Details1 dbo.Region dbo.Territories1 dbo.Shippers dbo.Orders1 dbo.Suppliers dbo.Products2 dbo.Territories dbo.EmployeeTerritories(18 row(s) affected)Tables and Tables Referenced REF_LEVEL TABLE_NAME TABLE_REFERENCED ----------- ---------------------------------------- ---------------------------------------- 0 dbo.ACTUAL_HOURS NULL1 dbo.Categories NULL2 dbo.CustomerCustomerDemo dbo.CustomerDemographics2 dbo.CustomerCustomerDemo dbo.Customers1 dbo.CustomerDemographics NULL1 dbo.Customers NULL1 dbo.Employees dbo.Employees3 dbo.EmployeeTerritories dbo.Employees3 dbo.EmployeeTerritories dbo.Territories3 dbo.Order Details dbo.Orders3 dbo.Order Details dbo.Products2 dbo.Orders dbo.Customers2 dbo.Orders dbo.Employees2 dbo.Orders dbo.Shippers0 dbo.Pivot NULL2 dbo.Products dbo.Categories2 dbo.Products dbo.Suppliers1 dbo.Region NULL1 dbo.Shippers NULL1 dbo.Suppliers NULL2 dbo.Territories dbo.Region(21 row(s) affected)Can you help me explain which to do first i got confused with the output of script. |
 |
|
|
|
|