<?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: SQL Server gets an ANSI compliant unique index &#8230; sort of</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/sql-server/sql-server-gets-an-ansi-compliant-unique-index-sort-of/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/sql-server/sql-server-gets-an-ansi-compliant-unique-index-sort-of/</link>
	<description></description>
	<lastBuildDate>Thu, 06 Jun 2013 18:56:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: BrianTkatch</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/sql-server-gets-an-ansi-compliant-unique-index-sort-of/#comment-318</link>
		<dc:creator>BrianTkatch</dc:creator>
		<pubDate>Fri, 16 Oct 2009 13:31:51 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=718#comment-318</guid>
		<description><![CDATA[Thanx. I&#039;m using 2005 here, and CREATEing a filtered INDEX failed. I appreciate you testing it and showing the results.

I would see benefit in having a filtered INDEX as the target of an FK. I have run into such situations before.

For example, let&#039;s say i have a system that has products, and imports information from another system that uses their own ids on a subset of products.

Product(MyId PK, Their_Id UNIQUE filter out NULLs);
Product_Info_From Other_System(Their_Id, info....)

I can modify the data on input to use our ids. However, if i want to keep the data as i get it, an FK to Their_Id would be nice. But, as they only have a subset of the products, i will have many NULLs in that COLUMN.]]></description>
		<content:encoded><![CDATA[<p>Thanx. I&#8217;m using 2005 here, and CREATEing a filtered INDEX failed. I appreciate you testing it and showing the results.</p>
<p>I would see benefit in having a filtered INDEX as the target of an FK. I have run into such situations before.</p>
<p>For example, let&#8217;s say i have a system that has products, and imports information from another system that uses their own ids on a subset of products.</p>
<p>Product(MyId PK, Their_Id UNIQUE filter out NULLs);<br />
Product_Info_From Other_System(Their_Id, info&#8230;.)</p>
<p>I can modify the data on input to use our ids. However, if i want to keep the data as i get it, an FK to Their_Id would be nice. But, as they only have a subset of the products, i will have many NULLs in that COLUMN.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mrdenny</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/sql-server-gets-an-ansi-compliant-unique-index-sort-of/#comment-316</link>
		<dc:creator>mrdenny</dc:creator>
		<pubDate>Fri, 16 Oct 2009 03:39:08 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=718#comment-316</guid>
		<description><![CDATA[Brianm
No it can&#039;t.  Running the following will throw an error (shown in the SQL Comment).  If you remove the WHERE clause from the CREATE UNIQUE INDEX then the constraint works (as expected).

[CODE]create table t1
(c1 int,
c2 int)
go
create unique index i1 on dbo.t1
(c1)
where c1 is not null
go
create table t2
(c1 int constraint fk_t2_t1 foreign key references t1(c1))
go


/*
Msg 1776, Level 16, State 0, Line 1
There are no primary or candidate keys in the referenced table &#039;t1&#039; that match the referencing column list in the foreign key &#039;fk_t2_t1&#039;.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
*/[/CODE]

I like the idea of being able to use that as a candidate index.  I&#039;ve submitted this as a [A href=&quot;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=498009&quot;]connect item [/A].  The more people that vote for it the better the chance that they will implement it in the next release (or the one after that).]]></description>
		<content:encoded><![CDATA[<p>Brianm<br />
No it can&#8217;t.  Running the following will throw an error (shown in the SQL Comment).  If you remove the WHERE clause from the CREATE UNIQUE INDEX then the constraint works (as expected).</p>
<p>[CODE]create table t1<br />
(c1 int,<br />
c2 int)<br />
go<br />
create unique index i1 on dbo.t1<br />
(c1)<br />
where c1 is not null<br />
go<br />
create table t2<br />
(c1 int constraint fk_t2_t1 foreign key references t1(c1))<br />
go</p>
<p>/*<br />
Msg 1776, Level 16, State 0, Line 1<br />
There are no primary or candidate keys in the referenced table &#8216;t1&#8242; that match the referencing column list in the foreign key &#8216;fk_t2_t1&#8242;.<br />
Msg 1750, Level 16, State 0, Line 1<br />
Could not create constraint. See previous errors.<br />
*/[/CODE]</p>
<p>I like the idea of being able to use that as a candidate index.  I&#8217;ve submitted this as a [A href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=498009"]connect item [/A].  The more people that vote for it the better the chance that they will implement it in the next release (or the one after that).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BrianTkatch</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/sql-server-gets-an-ansi-compliant-unique-index-sort-of/#comment-314</link>
		<dc:creator>BrianTkatch</dc:creator>
		<pubDate>Thu, 15 Oct 2009 14:21:30 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=718#comment-314</guid>
		<description><![CDATA[Can a filtered UNIQUE INDEX be FKed to?]]></description>
		<content:encoded><![CDATA[<p>Can a filtered UNIQUE INDEX be FKed to?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
