 




<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: T-SQL, and cascading updates or finding constraint names</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/t-sql-and-cascading-updates-or-finding-constraint-names/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/t-sql-and-cascading-updates-or-finding-constraint-names/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 17:28:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: sonotsky</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/t-sql-and-cascading-updates-or-finding-constraint-names/#comment-47792</link>
		<dc:creator>sonotsky</dc:creator>
		<pubDate>Fri, 18 Feb 2005 09:12:33 +0000</pubDate>
		<guid isPermaLink="false">#comment-47792</guid>
		<description><![CDATA[BeerMaker, et. al.,

Thanks for your feedback.  I was already aware of how to find the constrains via EntMan, but what I really need is a way to programmatically query and return, via SQL, which tables have foreign keys, or check constraints, or triggers, etc.

Since I posted my original question, I&#039;ve done some digging and think I&#039;ve made some progress.  Here&#039;s my SQL:

SELECT * FROM sysobjects
WHERE ((parent_obj != &#039;0&#039;) AND ((xtype = &#039;C&#039;) OR (xtype = &#039;D&#039;) OR (xtype = &#039;F&#039;) OR (xtype = &#039;IF&#039;) OR (xtype = &#039;TF&#039;) OR (xtype = &#039;TR&#039;) OR (xtype = &#039;UQ&#039;)))
ORDER BY parent_obj

I found that the parent_obj field of a dependancy object is the table ID, in sysobjects, of the parent table (duh).

I think all I have to do now is massage the results from this query and base/match the results to the list of selected tables returned by the previous query (see my original post).

I know that I can also do a subquery and combine the two, but I need to have the list of tables separate for reporting purposes (how many tables were affected, records modified per table, etc.).

If and when I figure this out, I will post a follow-up, but don&#039;t hold your breath.  :)
]]></description>
		<content:encoded><![CDATA[<p>BeerMaker, et. al.,</p>
<p>Thanks for your feedback.  I was already aware of how to find the constrains via EntMan, but what I really need is a way to programmatically query and return, via SQL, which tables have foreign keys, or check constraints, or triggers, etc.</p>
<p>Since I posted my original question, I&#8217;ve done some digging and think I&#8217;ve made some progress.  Here&#8217;s my SQL:</p>
<p>SELECT * FROM sysobjects<br />
WHERE ((parent_obj != &#8217;0&#8242;) AND ((xtype = &#8216;C&#8217;) OR (xtype = &#8216;D&#8217;) OR (xtype = &#8216;F&#8217;) OR (xtype = &#8216;IF&#8217;) OR (xtype = &#8216;TF&#8217;) OR (xtype = &#8216;TR&#8217;) OR (xtype = &#8216;UQ&#8217;)))<br />
ORDER BY parent_obj</p>
<p>I found that the parent_obj field of a dependancy object is the table ID, in sysobjects, of the parent table (duh).</p>
<p>I think all I have to do now is massage the results from this query and base/match the results to the list of selected tables returned by the previous query (see my original post).</p>
<p>I know that I can also do a subquery and combine the two, but I need to have the list of tables separate for reporting purposes (how many tables were affected, records modified per table, etc.).</p>
<p>If and when I figure this out, I will post a follow-up, but don&#8217;t hold your breath.  <img src='http://itknowledgeexchange.techtarget.com/itanswers/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.035 seconds using memcached
Object Caching 271/277 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 19:14:43 -->