<?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: Foreign Keys against Views	</title>
	<atom:link href="https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/feed/" rel="self" type="application/rss+xml" />
	<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/</link>
	<description></description>
	<lastBuildDate>Tue, 09 Jul 2024 01:24:55 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: Rob Farley		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-9430</link>

		<dc:creator><![CDATA[Rob Farley]]></dc:creator>
		<pubDate>Tue, 09 Jul 2024 01:24:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-9430</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-7978&quot;&gt;Karl Kieninger&lt;/a&gt;.

These days it&#039;s at https://youtu.be/j2CKy3zDRlE]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-7978">Karl Kieninger</a>.</p>
<p>These days it&#8217;s at <a href="https://youtu.be/j2CKy3zDRlE" rel="nofollow ugc">https://youtu.be/j2CKy3zDRlE</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Karl Kieninger		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-7978</link>

		<dc:creator><![CDATA[Karl Kieninger]]></dc:creator>
		<pubDate>Fri, 26 Jan 2024 13:19:58 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-7978</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-715&quot;&gt;robfarley&lt;/a&gt;.

I know, replying to a 14 year old comment, but.

I have used the talk as a reference over the years and shared it with other developers as a lesson in how to think better about SQL. Sadly, it is now a 404 error at SQLBits and I have not found it archived elsewhere. Any chance you have an could post it or a later version up here on LobsterPot or whereever?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-715">robfarley</a>.</p>
<p>I know, replying to a 14 year old comment, but.</p>
<p>I have used the talk as a reference over the years and shared it with other developers as a lesson in how to think better about SQL. Sadly, it is now a 404 error at SQLBits and I have not found it archived elsewhere. Any chance you have an could post it or a later version up here on LobsterPot or whereever?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dako		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-717</link>

		<dc:creator><![CDATA[Dako]]></dc:creator>
		<pubDate>Thu, 14 Jan 2010 14:46:33 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-717</guid>

					<description><![CDATA[That would be a great feature. I’ve missed it several times, where it would help ensuring business rules in the database. But I agree, seems there’s no way to do it in SQL Server so far. Nevertheless, I hope to be wrong :)]]></description>
			<content:encoded><![CDATA[<p>That would be a great feature. I’ve missed it several times, where it would help ensuring business rules in the database. But I agree, seems there’s no way to do it in SQL Server so far. Nevertheless, I hope to be wrong 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: TroyK		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-716</link>

		<dc:creator><![CDATA[TroyK]]></dc:creator>
		<pubDate>Mon, 11 Jan 2010 11:45:19 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-716</guid>

					<description><![CDATA[Unfortunately, SQL doesn&#039;t support this feature. It should, as a view and a base table are treated the same (i.e., simply as relations) in the relational model.

I gather from the discussion here that the desire is for the declaration to support some referential integrity rules. If that&#039;s the case, please check out the following two articles from a series I wrote. They explain how to convert a couple of different types of business rules (that could easily be supported by an FK to a view) into T-SQL implementations:

http://www.sqlservercentral.com/articles/Data+Modeling/61528/
http://www.sqlservercentral.com/articles/Data+Modeling/61529/

HTH,
TroyK
]]></description>
			<content:encoded><![CDATA[<p>Unfortunately, SQL doesn&#8217;t support this feature. It should, as a view and a base table are treated the same (i.e., simply as relations) in the relational model.</p>
<p>I gather from the discussion here that the desire is for the declaration to support some referential integrity rules. If that&#8217;s the case, please check out the following two articles from a series I wrote. They explain how to convert a couple of different types of business rules (that could easily be supported by an FK to a view) into T-SQL implementations:</p>
<p><a href="http://www.sqlservercentral.com/articles/Data+Modeling/61528/" rel="nofollow ugc">http://www.sqlservercentral.com/articles/Data+Modeling/61528/</a><br />
<a href="http://www.sqlservercentral.com/articles/Data+Modeling/61529/" rel="nofollow ugc">http://www.sqlservercentral.com/articles/Data+Modeling/61529/</a></p>
<p>HTH,<br />
TroyK</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: robfarley		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-715</link>

		<dc:creator><![CDATA[robfarley]]></dc:creator>
		<pubDate>Thu, 07 Jan 2010 00:23:23 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-715</guid>

					<description><![CDATA[I&#039;m not too interested in the StackOverflow points, that&#039;s fine.

I think the &#039;oversight&#039; applies only when you consider that you can&#039;t use a unique index that&#039;s on an indexed view for a FK. I consider that an indexed view essentially becomes a user-table that is maintained through changes to other tables - trigger-like if you will. 

And I think a FK should be created to reference an index, not a table. Then you could easily reference the index that&#039;s on the view, and it shouldn&#039;t really care. An index is an index, regardless of what it&#039;s on.

I do like your eagerness to use views. At some point soon, the recording of my &quot;Designing for Simplification&quot; talk from SQLBits should become available, at which point you should check it out and see how views can really enhance the developer experience.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not too interested in the StackOverflow points, that&#8217;s fine.</p>
<p>I think the &#8216;oversight&#8217; applies only when you consider that you can&#8217;t use a unique index that&#8217;s on an indexed view for a FK. I consider that an indexed view essentially becomes a user-table that is maintained through changes to other tables &#8211; trigger-like if you will. </p>
<p>And I think a FK should be created to reference an index, not a table. Then you could easily reference the index that&#8217;s on the view, and it shouldn&#8217;t really care. An index is an index, regardless of what it&#8217;s on.</p>
<p>I do like your eagerness to use views. At some point soon, the recording of my &#8220;Designing for Simplification&#8221; talk from SQLBits should become available, at which point you should check it out and see how views can really enhance the developer experience.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: BuschnicK		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-714</link>

		<dc:creator><![CDATA[BuschnicK]]></dc:creator>
		<pubDate>Wed, 06 Jan 2010 04:57:58 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-714</guid>

					<description><![CDATA[I&#039;m the guy who posed the original question. Thanks for trying to understand my problem and testing the various scenarious Rob. Can I split the reward on Stackoverflow somehow? Because the currently top-voted answer by Damir deserves respect for the effort he put into it as well.

Anyways, I haven&#039;t found a solution yet and will probably go with manually filtering/joining (as per the most common suggestion in the StackOverflow thread) the views so that the data is consistent at all times. Still seems like an oversight in SQLServer to me.

BTW, what I&#039;m trying to archive with the whole setup is to have one underlying dataset, the &quot;truth&quot;, and several different interpretations/views on it. This should accomodate users who don&#039;t have enough rights to view the full set or just want to work on a subset.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m the guy who posed the original question. Thanks for trying to understand my problem and testing the various scenarious Rob. Can I split the reward on Stackoverflow somehow? Because the currently top-voted answer by Damir deserves respect for the effort he put into it as well.</p>
<p>Anyways, I haven&#8217;t found a solution yet and will probably go with manually filtering/joining (as per the most common suggestion in the StackOverflow thread) the views so that the data is consistent at all times. Still seems like an oversight in SQLServer to me.</p>
<p>BTW, what I&#8217;m trying to archive with the whole setup is to have one underlying dataset, the &#8220;truth&#8221;, and several different interpretations/views on it. This should accomodate users who don&#8217;t have enough rights to view the full set or just want to work on a subset.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: robfarley		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-713</link>

		<dc:creator><![CDATA[robfarley]]></dc:creator>
		<pubDate>Mon, 04 Jan 2010 22:43:30 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-713</guid>

					<description><![CDATA[Actually, on Stack Overflow, if there is a bounty put on a question, then the question with the most votes gets auto-accepted after seven days (if it has at least two). You can read this on the FAQ page there at http://stackoverflow.com/faq ]]></description>
			<content:encoded><![CDATA[<p>Actually, on Stack Overflow, if there is a bounty put on a question, then the question with the most votes gets auto-accepted after seven days (if it has at least two). You can read this on the FAQ page there at <a href="http://stackoverflow.com/faq" rel="nofollow ugc">http://stackoverflow.com/faq</a> </p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: David Gardiner		</title>
		<link>https://lobsterpot.com.au/blog/2010/01/05/foreign-keys-against-views/#comment-712</link>

		<dc:creator><![CDATA[David Gardiner]]></dc:creator>
		<pubDate>Mon, 04 Jan 2010 22:33:26 +0000</pubDate>
		<guid isPermaLink="false">/blogs/robfarley/archive/2010/01/05/foreign-keys-against-views.aspx#comment-712</guid>

					<description><![CDATA[Unless something has changed recently, Stack Overflow doesn&#039;t automatically mark an answer as correct.

The questioner chooses the answer they like the best - and maybe a user with enough reputation can do it too.

-dave]]></description>
			<content:encoded><![CDATA[<p>Unless something has changed recently, Stack Overflow doesn&#8217;t automatically mark an answer as correct.</p>
<p>The questioner chooses the answer they like the best &#8211; and maybe a user with enough reputation can do it too.</p>
<p>-dave</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
