Курсовая работа: Информационная система военного округа

where t.[Nomer_podrazdelenia] = d.[Nomer_podrazdelenia])

begin

raiserror 50001 'Children still exist in table ''Soorugenia''. Cannot update parent table ''Podrazdelenie''.'

rollback transaction

return

end

end

end

go

/* Delete trigger "td_Chast" for table "Chast" */

Create trigger [td_Chast]

on [Chast] for delete as

begin

declare @numrows int

select @numrows = @@rowcount

if @numrows = 0

return

/* Restrict child "Rota" when parent "Chast" deleted */

if exists (select 1 from [Rota] t, deleted d

where t.[Nomer_podrazdelenia] = d.[Nomer_podrazdelenia] and

t.[tip_i_nomer_obedinenia] = d.[tip_i_nomer_obedinenia] and

t.[nazvanie_armii] = d.[nazvanie_armii] and

t.[Mesto] = d.[Mesto])

begin

raiserror 50003 'Children still exist in table ''Rota''. Cannot delete from parent table ''Chast''.'

rollback transaction

return

end

end

К-во Просмотров: 1252
Бесплатно скачать Курсовая работа: Информационная система военного округа