Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***Transaccion Insertar Asada Con su telefono****/
- GO
- CREATE PROCEDURE insertAsadas(@nombre VARCHAR(30), @direccion tipo_direccion, @numero tipo_telefono)
- AS
- DECLARE @idAsada SMALLINT,
- @error SMALLINT
- SET @idAsada = 0
- SET @error = 0
- BEGIN TRANSACTION
- INSERT INTO asadas(nombre, direccion) VALUES (@nombre, @direccion)
- IF @@ERROR > 0
- SET @error = 1
- SET @idAsada = @@IDENTITY
- INSERT INTO telefonos_asadas(idAsada, numero) VALUES (@idAsada, @numero)
- IF @@ERROR > 0
- SET @error = 1
- IF @error = 1
- BEGIN
- ROLLBACK tran
- print ('Error en la inserción de la Asada')
- END
- ELSE
- commit tran
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement