﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss content posted by Jorge Novo / Article Discussions / Article Discussions by Author  / Truncate All Tables Part 2 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 15:47:04 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Truncate All Tables Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic554650-463-1.aspx</link><description>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</description><pubDate>Thu, 26 Aug 2010 08:18:29 GMT</pubDate><dc:creator>dhearne</dc:creator></item><item><title>RE: Truncate All Tables Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic554650-463-1.aspx</link><description>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.</description><pubDate>Mon, 24 Nov 2008 14:22:47 GMT</pubDate><dc:creator>Jorge Novo-@ETLDEVDBA</dc:creator></item><item><title>RE: Truncate All Tables Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic554650-463-1.aspx</link><description>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</description><pubDate>Mon, 24 Nov 2008 09:23:50 GMT</pubDate><dc:creator>ramu.valleti</dc:creator></item><item><title>RE: Truncate All Tables Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic554650-463-1.aspx</link><description>What's seems to be the problem</description><pubDate>Thu, 20 Nov 2008 09:01:26 GMT</pubDate><dc:creator>Jorge Novo-@ETLDEVDBA</dc:creator></item><item><title>RE: Truncate All Tables Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic554650-463-1.aspx</link><description>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&amp;Regards,Ramu</description><pubDate>Thu, 20 Nov 2008 07:54:24 GMT</pubDate><dc:creator>ramu.valleti</dc:creator></item><item><title>Truncate All Tables Part 2</title><link>http://www.sqlservercentral.com/Forums/Topic554650-463-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/restore+relationship+cursor/64085/"&gt;Truncate All Tables Part 2&lt;/A&gt;[/B]</description><pubDate>Mon, 18 Aug 2008 16:35:20 GMT</pubDate><dc:creator>Jorge Novo-@ETLDEVDBA</dc:creator></item></channel></rss>