Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DROP PROCEDURE insertarProyecto
- CREATE PROCEDURE insertarProyecto (
- @nombre VARCHAR(105)
- ,@idAsada INT
- , @descripcion VARCHAR(1000)
- , @fechaInicio DATETIME
- , @fechaFinalizacion DATETIME
- )
- AS
- DECLARE @error TINYINT
- SET @error = 0
- BEGIN TRANSACTION
- INSERT INTO proyectos(nombre, idAsada, descripcion, fechaInicio, fechaFinalizacion)
- VALUES (@nombre, @idAsada, @descripcion, @fechaInicio, @fechaFinalizacion)
- IF @@ERROR > 0 SET @error = 1
- IF @error = 1
- BEGIN
- ROLLBACK TRAN -- DESHAGA LA TRANSACCION
- PRINT('Error en la insercion del proyecto')
- END
- ELSE
- COMMIT TRAN -- FINALICE LA TRANSACCION
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement