| 
                
Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | desikankannanPosting Yak  Master
 
 
                                        152 Posts | 
                                            
                                            |  Posted - 2013-11-19 : 08:04:34 
 |  
                                            | Hi,I want to insert NULL value in foreign key reference, my field name isfid i try to insert NULL value to this field   did = '' below find my queryUPDATE DeathData SET FirstName = 'Jack', MiddleName = '', LastName = 'Brown', Title = '', BirthDate = '2/1/1933', DeathDate = '7/30/2008', VisitationLocation = 'Mowery Funeral Service', VisitationDate = '8/1/2008', VisitationTime = '1:00 p.m.-8:00 p.m. ', FuneralDate = '8/2/2008', FuneralTime = '10:00 a.m.', ObitText = 'Public', ObitPhoto = 'obitphotos/brownjack.jpg', BurialTime = '', FuneralType = 'Public', BurialType = 'Public', Note = '', DisplayOnWebsite = 'Y', fid = '46', bid = '294', did = ''  WHERE ID = 29error messageMsg 547, Level 16, State 0, Line 1The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_Donations". The conflict occurred in database "Moweryfinal", table "dbo.tbldonations", column 'did'.The statement has been terminated.Desikankannan |  |  
                                    | James KMaster Smack Fu Yak Hacker
 
 
                                    3873 Posts | 
                                        
                                          |  Posted - 2013-11-19 : 08:14:57 
 |  
                                          | You need to have a row with the value of '' in the did column of the referring dbo.tbldonations table. |  
                                          |  |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2013-11-19 : 09:09:12 
 |  
                                          | '' is not same as NULL'' means blank valuewhereas NULL means unknown value. Its not stored internally as a value in SQL Server. It just represents condition unknown valueto set it to NULL you need to explicitly pass it asdid = NULL and not did = ''------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |  
                                          |  |  |  
                                |  |  |  |  |  |