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

end

end

end

go

/* Update trigger "tu_Podrazdelenie" for table "Podrazdelenie" */

Create trigger [tu_Podrazdelenie]

on [Podrazdelenie] for update as

begin

declare @numrows int

select @numrows = @@rowcount

if @numrows = 0

return

/* Restrict child "armia" when parent "Podrazdelenie" updated */

if update([Nomer_podrazdelenia])

begin

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

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

begin

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

rollback transaction

return

end

end

/* Restrict child "sostav" when parent "Podrazdelenie" updated */

if update([Nomer_podrazdelenia])

begin

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

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

begin

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