--T-Sql Block go delete from authors where au_id='172-32-1176' declare @d int =@@ERROR update authors set au_lname=NULL where au_id='172-32-1176' declare @u int =@@ERROR if @d<>0 print 'Error occured in delete' if @u<>0 print 'Error occured in update' go
Quote: Msg 547, Level 16, State 0, Line 1 The DELETE statement conflicted with the REFERENCE constraint "FK__titleauth__au_id__0519C6AF". The conflict occurred in database "pubs", table "dbo.titleauthor", column 'au_id'. The statement has been terminated. Msg 515, Level 16, State 2, Line 3 Cannot insert the value NULL into column 'au_lname', table 'pubs.dbo.authors'; column does not allow nulls. UPDATE fails. The statement has been terminated. Error occured in delete Error occured in update
TRY CATCH
TSQL
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)