Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Truncate All Tables Part 2 Expand / Collapse
Author
Message
Posted Monday, August 18, 2008 4:35 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 15, 2013 6:55 PM
Points: 137, Visits: 251
Comments posted to this topic are about the item Truncate All Tables Part 2
Post #554650
Posted Thursday, November 20, 2008 7:54 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, March 07, 2013 12:16 AM
Points: 381, Visits: 340
Hello there,

when i execute part1 and part2 together the whole query is executing properly, but it is not restoring the FK constraints properly.

can anybody help me on this regard?.....


Thanks&Regards,
Ramu




Ramu
No Dream Is Too Big....!
Post #605830
Posted Thursday, November 20, 2008 9:01 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 15, 2013 6:55 PM
Points: 137, Visits: 251
What's seems to be the problem
Post #605886
Posted Monday, November 24, 2008 9:23 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, March 07, 2013 12:16 AM
Points: 381, Visits: 340
I've a database which has, two dimension and one fact table.

when i run the script, it is restoring primary keys successfully, but not FK relations in the fact table.

I mean my fact table doesn't hold any relation with the dimension tables after running the script.

Please tell me what might be the problem?.. is it with my database or script?



Regards,
Ramu




Ramu
No Dream Is Too Big....!
Post #607659
Posted Monday, November 24, 2008 2:22 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 15, 2013 6:55 PM
Points: 137, Visits: 251
One of the problems that I see a lot is that when trying to restore the relationship there are orphans on the tables. Ensure that all the foreign keys from the parent are present on the tables. For example. If table A has ID ( 1,2,3,4,5,6) and a child table B has the FK's (1,4,5,6) After dropping all the constraints we delete the records (5,6) on table A but fail to delete records (5,6) on table B, the script will fail to restore the constraint between Table A and B because now B has FK's (5,6) as orphans. The issue can be many things but I will start to look into the orphan issue First. Can you send the DDL of the tables? or a similar DDL I just want to see the kind of constraint between the tables.
Post #607882
Posted Thursday, August 26, 2010 8:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 28, 2010 11:52 AM
Points: 1, Visits: 31
Jorge,

This is great stuff!

However, it seems as though the restore portion does not correctly restore relationships that are based on more than one column.

I think there needs to be a loop in the dynamic sql section that will iterate through the values in the sysforeignkeys.keyno field. You capture that data in the first part, but do not appear to use it in the restore process.

If I am incorrect, my sincerest apologies. I ask only because I would hate to lose the multi-column FK relationships on my databases!

-Dave
Post #975679
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse