﻿<?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 Jean Charles Bulinckx / Article Discussions / Article Discussions by Author  / Indexed Views With Outer Joins / 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, 22 May 2013 05:48:39 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Indexed Views With Outer Joins</title><link>http://www.sqlservercentral.com/Forums/Topic180031-228-1.aspx</link><description>Your example doesn't work.In the left and right joins, Father 3 is displayed.With the isnull(....), there is no child record in the son table to apply the isnull too, therefore, the father record never appears.</description><pubDate>Tue, 23 Apr 2013 05:03:07 GMT</pubDate><dc:creator>Pridmore_James</dc:creator></item><item><title>RE: Indexed Views With Outer Joins</title><link>http://www.sqlservercentral.com/Forums/Topic180031-228-1.aspx</link><description>You don't have to use null you can insert a record with the id of zero, a negative number, etc.. still quite the rig, but might get you out of a jam.</description><pubDate>Thu, 01 Apr 2010 08:22:38 GMT</pubDate><dc:creator>Steve Stocker</dc:creator></item><item><title>RE: Indexed Views With Outer Joins</title><link>http://www.sqlservercentral.com/Forums/Topic180031-228-1.aspx</link><description>&lt;P&gt;Hello guys thanks for the reply!&lt;/P&gt;&lt;P&gt;Pete,&lt;/P&gt;&lt;P&gt;this chunk of code works fine&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;INSERT INTO Father (Father_id, Father_name) values(-255,'No father')...&lt;/P&gt;&lt;P&gt;on isnull(s.father_id, -255)=f.father_id&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;but &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;INSERT INTO Father (Father_id, Father_name) values(null,'No father')...&lt;/P&gt;&lt;P&gt;on s.father_id = f.father_id&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;don´t work at all, no childs without father is show.&lt;/P&gt;&lt;P&gt;At the other hand i canot change the row&lt;/P&gt;&lt;P&gt;INSERT INTO Son values(null,'Child 0X of no father')   &lt;/P&gt;&lt;P&gt;to &lt;/P&gt;&lt;P&gt;INSERT INTO Son values(-255,'Child 0X of no father')   &lt;/P&gt;&lt;P&gt;because at my realworld problem that table contains millions of rows with null values and dont want change my old data.&lt;/P&gt;&lt;P&gt;Adam,&lt;/P&gt;&lt;P&gt;At my problem Father_id is a IDENTITY column and cannot be nullable.&lt;/P&gt;&lt;P&gt;Guys,&lt;/P&gt;&lt;P&gt;It´s just a example from real problem. Of course u can find yourself in a bit different dilema. I´m happy to share my solution and to learn from yours replys.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description><pubDate>Fri, 20 May 2005 11:14:00 GMT</pubDate><dc:creator>jcb</dc:creator></item><item><title>RE: Indexed Views With Outer Joins</title><link>http://www.sqlservercentral.com/Forums/Topic180031-228-1.aspx</link><description>Peter,You can insert a NULL row even if there's a foreign key:use tempdbgocreate table a (aid int not null primary key)insert a values (1)gocreate table b (aid int references a (aid))insert b values (null)goselect * from bgodrop table bdrop table ago</description><pubDate>Thu, 19 May 2005 12:24:00 GMT</pubDate><dc:creator>Adam Machanic</dc:creator></item><item><title>RE: Indexed Views With Outer Joins</title><link>http://www.sqlservercentral.com/Forums/Topic180031-228-1.aspx</link><description>First, if you created a foreign key on father_id you wouldn't be able to insert the null son record.Second, since -255 is your default value for 'no father' in the Father table why not remove the isnull() from the view and use -255 as the value for 'no father' in the son table?  Then everything works fine with an inner join and foreign key?Edit:  Oh yeah, the table name says [Family] on the create index statements.</description><pubDate>Thu, 19 May 2005 06:40:00 GMT</pubDate><dc:creator>peterlemonjello</dc:creator></item><item><title>Indexed Views With Outer Joins</title><link>http://www.sqlservercentral.com/Forums/Topic180031-228-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF="http://www.sqlservercentral.com/columnists/jBulinckx/indexedviewswithouterjoins.asp"&gt;http://www.sqlservercentral.com/columnists/jBulinckx/indexedviewswithouterjoins.asp&lt;/A&gt;</description><pubDate>Wed, 04 May 2005 16:35:00 GMT</pubDate><dc:creator>jcb</dc:creator></item></channel></rss>