Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------Tiggers---------------------------------------
- CREATE TRIGGER tr_innsert_ciudadanos ON ciudadanos instead OF INSERT
- AS
- BEGIN
- DECLARE @Limite INT = 5;
- DECLARE @Contador INT;
- SELECT @Contador = COUNT(1) FROM CIUDADANOS;
- IF @Contador <= @Limite
- BEGIN
- SET nocount ON;
- INSERT INTO CIUDADANOS VALUES(0011,'karla','Buenaventura',2,20/12/1999,'Pedro Brand',1,2,2,1,5,1,2,2,2,1999)
- INSERT INTO CIUDADANOS VALUES(0012,'FIOR','GONZALEZ',2,20/11/1998,'Pedro Brand',1,2,2,1,5,1,2,2,2,1998)
- INSERT INTO CIUDADANOS VALUES(0013,'YESICA','Buenaventura',2,05/12/1999,'Pedro Brand',1,2,2,1,5,1,2,2,2,1999)
- INSERT INTO CIUDADANOS VALUES(0014,'JESSENIA','ROSALES',2,20/12/1999,'Pedro Brand',1,2,2,1,5,1,2,2,2,1999)
- INSERT INTO CIUDADANOS VALUES(0015,'YOHA','TINEO',2,07/12/1999,'Pedro Brand',1,2,2,1,5,1,2,2,2,1999)
- INSERT INTO CIUDADANOS VALUES(0016,'PERLA','Buenaventura',2,30/12/1999,'Pedro Brand',1,2,2,1,5,1,2,2,2,1999)
- SET nocount off;
- END
- ELSE
- RAISERROR ('No puede insertar más de %d registros a la vez', 16, 1, @Limite);
- END
Advertisement
Add Comment
Please, Sign In to add comment