<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: How to Script Out all The Foreign Keys of a Table</title>
	<atom:link href="http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html</link>
	<description>Random thoughts and news by Andrew Chen and friends</description>
	<pubDate>Thu, 09 Feb 2012 13:33:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Vishal</title>
		<link>http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-146840</link>
		<dc:creator>Vishal</dc:creator>
		<pubDate>Tue, 12 Jul 2011 22:02:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-146840</guid>
		<description>great script. but does not work if there are multiple columns in the foreign key. it returns me 2 drop statement (which is okay) but two create statements - one for each column like this:

ALTER TABLE TABLE_NAME ADD CONSTRAINT FK__TABLE_NAME__SOMENAME FOREIGN KEY (COLUMN_1) REFERENCES CUSTOMER (COLUMN_1)
ALTER TABLE TABLE_NAME ADD CONSTRAINT FK__TABLE_NAME__SOMENAME FOREIGN KEY (COLUMN_2) REFERENCES CUSTOMER (COLUMN_2)


any way to get them all in one statemenet?</description>
		<content:encoded><![CDATA[<p>great script. but does not work if there are multiple columns in the foreign key. it returns me 2 drop statement (which is okay) but two create statements - one for each column like this:</p>
<p>ALTER TABLE TABLE_NAME ADD CONSTRAINT FK__TABLE_NAME__SOMENAME FOREIGN KEY (COLUMN_1) REFERENCES CUSTOMER (COLUMN_1)<br />
ALTER TABLE TABLE_NAME ADD CONSTRAINT FK__TABLE_NAME__SOMENAME FOREIGN KEY (COLUMN_2) REFERENCES CUSTOMER (COLUMN_2)</p>
<p>any way to get them all in one statemenet?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shrini Viswanathan</title>
		<link>http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-142576</link>
		<dc:creator>Shrini Viswanathan</dc:creator>
		<pubDate>Tue, 14 Jun 2011 14:46:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-142576</guid>
		<description>Absolutely perfect. Was going to break my head with management studio. Good thing I looked. This took fraction of a second to generate what the scripts.

Thanks much.</description>
		<content:encoded><![CDATA[<p>Absolutely perfect. Was going to break my head with management studio. Good thing I looked. This took fraction of a second to generate what the scripts.</p>
<p>Thanks much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sql admin</title>
		<link>http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-82352</link>
		<dc:creator>sql admin</dc:creator>
		<pubDate>Sun, 14 Feb 2010 20:02:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-82352</guid>
		<description>Thanks man. That is very useful</description>
		<content:encoded><![CDATA[<p>Thanks man. That is very useful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jessica</title>
		<link>http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-80350</link>
		<dc:creator>jessica</dc:creator>
		<pubDate>Sat, 23 Jan 2010 04:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-80350</guid>
		<description>i got these errors: 

Msg 102, Level 15, State 1, Line 572
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 579
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 580
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 585
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 592
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 612
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 619
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 655
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 694
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 695
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 705
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 743
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 754
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 758
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 770
Incorrect syntax near '.'.</description>
		<content:encoded><![CDATA[<p>i got these errors: </p>
<p>Msg 102, Level 15, State 1, Line 572<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 579<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 580<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 585<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 592<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 612<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 619<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 655<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 694<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 695<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 705<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 743<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 754<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 758<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 770<br />
Incorrect syntax near &#8216;.&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jessica</title>
		<link>http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-80349</link>
		<dc:creator>jessica</dc:creator>
		<pubDate>Sat, 23 Jan 2010 04:09:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.siusic.com/wphchen/how-to-script-out-all-the-foreign-keys-of-a-table-106.html#comment-80349</guid>
		<description>i got these error messages

Msg 102, Level 15, State 1, Line 754
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 758
Incorrect syntax near '.'.
Msg 102, Level 15, State 1, Line 770
Incorrect syntax near '.'.</description>
		<content:encoded><![CDATA[<p>i got these error messages</p>
<p>Msg 102, Level 15, State 1, Line 754<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 758<br />
Incorrect syntax near &#8216;.&#8217;.<br />
Msg 102, Level 15, State 1, Line 770<br />
Incorrect syntax near &#8216;.&#8217;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

