Курсовая работа: Информационная система военного округа
update([nazvanie_armii]) or
update([Mesto])
begin
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 50001 'Children still exist in table ''Rota''. Cannot update parent table ''Chast''.'
rollback transaction
return
end
end
end
go
/* Update trigger "tu_Rota" for table "Rota" */
Create trigger [tu_Rota]
on [Rota] for update as
begin
declare @numrows int
select @numrows = @@rowcount
if @numrows = 0
return
/* Restrict child "Vzvod" when parent "Rota" updated */
if update([Nazv_roti]) or
update([Nomer_podrazdelenia]) or
update([tip_i_nomer_obedinenia]) or
update([nazvanie_armii]) or