Guest User

Untitled

a guest
Sep 5th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.38 KB | None | 0 0
  1. create trigger blokada_ad_pres
  2. on employees
  3. for insert, update
  4. as
  5. begin
  6. declare @job varchar (max)
  7.  
  8. select @job = job_id from inserted
  9.  
  10. if exists ((select job_id from employees where job_id like 'AD_PRES') and (@job_id = 'AD_PRES'))
  11.     begin
  12.     print 'Istnieje już pracownik o job_id = ADPRES'
  13.     rollback transaction
  14.     end
  15.  
  16. else
  17.     begin
  18.     print 'dodano nowego pracownika'
  19.     end
  20.  
  21. end
Advertisement
Add Comment
Please, Sign In to add comment