Alter table PersonTbl alter column contactid int null
update PersonTbl set contactid=null where contactid =0
UPDATE    PersonTbl
SET              ContactId = NULL
WHERE     (NOT (ContactId IN
                          (SELECT     ID
                             FROM         TelBook)))
ALTER TABLE dbo.PersonTbl ADD CONSTRAINT
	FK_PersonTbl_TelBook FOREIGN KEY
	(
	ContactId
	) REFERENCES dbo.TelBook
	(
	ID
	) ON UPDATE  NO ACTION 
	 ON DELETE  SET NULL 
	
GO
