Курсовая работа: Информационная система военного округа
if @numrows = 0
return
/* Restrict child "armia" when parent "Podrazdelenie" deleted */
if exists (select 1 from [armia] t, deleted d
where t.[Nomer_podrazdelenia] = d.[Nomer_podrazdelenia])
begin
raiserror 50003 'Children still exist in table ''armia''. Cannot delete from parent table ''Podrazdelenie''.'
rollback transaction
return
end
/* Restrict child "sostav" when parent "Podrazdelenie" deleted */
if exists (select 1 from [sostav] t, deleted d
where t.[Nomer_podrazdelenia] = d.[Nomer_podrazdelenia])
begin
raiserror 50003 'Children still exist in table ''sostav''. Cannot delete from parent table ''Podrazdelenie''.'
rollback transaction
return
end
/* Restrict child "Tehnika" when parent "Podrazdelenie" deleted */
if exists (select 1 from [Tehnika] t, deleted d
where t.[Nomer_podrazdelenia] = d.[Nomer_podrazdelenia])
begin
raiserror 50003 'Children still exist in table ''Tehnika''. Cannot delete from parent table ''Podrazdelenie''.'
rollback transaction
return
end
/* Restrict child "Voorugenie" when parent "Podrazdelenie" deleted */
if exists (select 1 from [Voorugenie] t, deleted d
where t.[Nomer_podrazdelenia] = d.[Nomer_podrazdelenia])