43 lines
1.1 KiB
SQL
43 lines
1.1 KiB
SQL
|
|
/*************************************
|
|
* STORED PROCEDURE sp_insRichiesta
|
|
* Inserisce nuova richiesta di intervento
|
|
*
|
|
* modif.: S.E.L. - 2009.02.20
|
|
**************************************/
|
|
CREATE PROCEDURE sp_insRichiesta
|
|
(
|
|
@richiesta datetime,
|
|
@dataLav datetime,
|
|
@turnoLav int,
|
|
@matr varchar(10),
|
|
@guasto datetime,
|
|
@idxAmbito int,
|
|
@idxPriorita int,
|
|
@isFermo bit,
|
|
@idxTipo int,
|
|
@idxImpianto int,
|
|
@idxMacchina int,
|
|
@descrizione varchar(2500),
|
|
@idxCausale int,
|
|
@scheduled bit,
|
|
@numIntMtz int output
|
|
)
|
|
AS
|
|
|
|
BEGIN tran
|
|
|
|
INSERT INTO InterventiMtz
|
|
(richiesta, dataLav, turnoLav, matr, guasto, idxAmbito, idxPriorita, isFermo, idxTipo, idxImpianto, idxMacchina, descrizione, idxStato, idxCausale, scheduled)
|
|
VALUES (@richiesta,@dataLav,@turnoLav,@matr,@guasto,@idxAmbito,@idxPriorita,@isFermo,@idxTipo,@idxImpianto,@idxMacchina,@descrizione,
|
|
1,@idxCausale,@scheduled)
|
|
|
|
/*************************************
|
|
* salvo idx del nuovo record
|
|
**************************************/
|
|
SET @numIntMtz = SCOPE_IDENTITY()
|
|
|
|
COMMIT tran
|
|
|
|
RETURN (@numIntMtz)
|