• Hello guys thanks for the reply!

    Pete,

    this chunk of code works fine

    ...

    INSERT INTO Father (Father_id, Father_name) values(-255,'No father')

    ...

    on isnull(s.father_id, -255)=f.father_id

    ...

    but

    ...

    INSERT INTO Father (Father_id, Father_name) values(null,'No father')

    ...

    on s.father_id = f.father_id

    ...

    don´t work at all, no childs without father is show.

    At the other hand i canot change the row

    INSERT INTO Son values(null,'Child 0X of no father')  

    to

    INSERT INTO Son values(-255,'Child 0X of no father')  

    because at my realworld problem that table contains millions of rows with null values and dont want change my old data.

    Adam,

    At my problem Father_id is a IDENTITY column and cannot be nullable.

    Guys,

    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.

     

    Jean