Advertisement
xickoh

tempo bloqueio

Jul 9th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. CREATE TRIGGER preventSameTimeBloqueio
  2. ON bloqueio
  3. INSTEAD OF INSERT
  4. AS
  5. BEGIN
  6.  
  7. declare @tempo datetime;
  8. declare @idBloqueio int;
  9. declare @idContacto int;
  10.  
  11. SELECT @tempo=tempo, @idBloqueio=idBloqueio, @idContacto=idContacto FROM inserted
  12.  
  13. IF @tempo = getdate();
  14. BEGIN
  15. Print 'O tempo de bloqueio não pode ser igual a 0';
  16. ROLLBACK TRANSACTION
  17. END
  18.  
  19. ELSE
  20. BEGIN
  21.  
  22. INSERT INTO bloqueio (idBloqueio, idContacto, Tempo) VALUES (@tempo, @idBloqueio, @idContacto)
  23.  
  24. END
  25.  
  26. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement