SCRIPT SELECTIONNE :
QC18598 - Activation module DD sur prepaiement.sql
/*
purpose : UPDATE HOTEL_PARAMETER
author : MG
date : 12/10/2015
comment : To apply on EXXXX
QC :
Purpose : the script update the PARH_AR_MHC (DHC) to the first day of the month
Version : 1.1 set 'hote_code' instead of 'hote_id' (to take alphanumeric code into consideration)
*/
Set nocount on
Declare @Error int
Declare @NbRec int
Declare @hote_code nvarchar(4)
Declare @date_dhc date
Declare @hote_id int
set @hote_code = 'XXXX' ------------ replace XXXX by the Hotel code (if the hotel contains only 3 numbers, do not forget the first 0): for instance 752, A0E7, 1986
set @date_dhc = 'YYYY-MM-01' ------------ set the DHC date with the format YYYY-MM-01
select @hote_id=hote_id from hotel where hote_code=@hote_code
-- Query
-------------------------------------------------
update hotel_parameter set PARH_AR_MHC = @date_dhc where hote_id = @hote_id
-------------------------------------------------
-- End query
set @NbRec = @@rowcount
Set @Error = @@error If @Error <> 0 Goto Err
Print 'Correction effectuée : ' + LTrim(Str(@NbRec)) + ' enregistrements affectés'
Err:
If @Error<> 0
Begin
Raiserror ('Error the treatment" - ERROR NUMBER : %d ', 16, -1,'', ' ', @Error)
End
© Untitled. All rights reserved. | Support Technique Fols N2