It's really not a good idea for a relationship table to allow nulls for the entities they are relating. <sarcasm>Typically, a record won't be created until there is an actual relationship.</sarcasm>However, if this doesn't solve your issue, post your actual DDL with sample DML and expected results:set nocount ondeclare @employee table (employeeid int, supervisorid int)declare @employeeRelationship table (parentid int, childid int)insert @employee select 1, null unionselect 2,1 unionselect 3,2 unionselect 4, null unionselect 5, 4 unionselect 6, 2insert @employeeRelationship select 1,2 unionselect 2,3 unionselect 4,5 unionselect null, 6select * from @employeeprint 'pre update'select * from @employeeRelationshipupdate a set a.parentid = b.supervisoridfrom @employeeRelationship ajoin @employee b on a.childid = b.employeeidprint 'post update'select * from @employeeRelationship
Be One with the OptimizerTG