53 lines
1.5 KiB
Transact-SQL
53 lines
1.5 KiB
Transact-SQL
|
|
-- =============================================
|
|
-- Author: Steamware - S.E.L.
|
|
-- Create date: 2014.05.20
|
|
-- Description: update di un record in QL (Full) TIPO SIMULAZIONE e poi aggiorna a cascata
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[stp_QLS_UpdDiesPar]
|
|
(
|
|
@Original_QuoteType CHAR(1) = 'S',
|
|
@Original_CodQuote BIGINT = 0,
|
|
@Original_QuoteRev INT = 0,
|
|
@SamplePrice DECIMAL(18, 6),
|
|
@DiesPriceClientQuote DECIMAL(18, 6),
|
|
@DiesCommLife DECIMAL(18, 6),
|
|
@MonthSalesPrev INT
|
|
)
|
|
AS
|
|
|
|
SET XACT_ABORT ON;
|
|
BEGIN TRAN
|
|
|
|
-- @SamplePrice
|
|
EXEC stp_QSP_upsert @Original_QuoteType, @Original_CodQuote, @Original_QuoteRev, 'SamplePrice', @SamplePrice
|
|
|
|
-- @DiesPriceClientQuote
|
|
EXEC stp_QSP_upsert @Original_QuoteType, @Original_CodQuote, @Original_QuoteRev, 'DiesPriceClientQuote', @DiesPriceClientQuote
|
|
|
|
-- @DiesCommLife
|
|
EXEC stp_QSP_upsert @Original_QuoteType, @Original_CodQuote, @Original_QuoteRev, 'DiesCommLife', @DiesCommLife
|
|
|
|
-- @MonthSalesPrev
|
|
EXEC stp_QSP_upsert @Original_QuoteType, @Original_CodQuote, @Original_QuoteRev, 'MonthSalesPrev', @MonthSalesPrev
|
|
|
|
|
|
-- update dei valori calcolati!
|
|
EXEC stp_QL_fullDataUpdate @Original_QuoteType
|
|
,@Original_CodQuote
|
|
,@Original_QuoteRev
|
|
,'Y'
|
|
|
|
COMMIT TRAN
|
|
|
|
|
|
-- seleziono intera riga!
|
|
|
|
SELECT *
|
|
FROM v_QuoteFull_Q
|
|
WHERE QuoteType = @Original_QuoteType
|
|
AND CodQuote = @Original_CodQuote
|
|
AND QuoteRev = @Original_QuoteRev
|
|
|
|
|
|
RETURN |