Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GO
- -- DROP PROCEDURE insertarEntrega
- CREATE PROCEDURE asociarUsuarioProyecto (
- @idUsuario INT
- , @idProyecto INT
- )
- AS
- DECLARE @error TINYINT
- SET @error = 0
- BEGIN TRANSACTION
- INSERT INTO usuarios_proyectos(idUsuario, idProyecto)VALUES (@idUsuario, @idUsuario)
- IF @@ERROR > 0 SET @error = 1
- IF @error = 1
- BEGIN
- ROLLBACK TRAN -- DESHAGA LA TRANSACCION
- PRINT('Error asociando el usuario con el proyecto')
- END
- ELSE
- COMMIT TRAN -- FINALICE LA TRANSACCION
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement