Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- start transaction
- BEGIN TRANSACTION
- DECLARE @ErrCnt int=0;
- SET Identity_Insert tbRate_non ON;
- -- vv template generating with php array, take (@lastIRCode,'non','1970-01-01','test',0,10,10,0,0) for example
- DECLARE @lastIRCode int=0; -- re-assined 0 for every row in excel row array
- DELETE FROM tbRate_non WHERE CoCode='non' AND EffectiveDate='1970-01-01' AND EngName='test' AND Age=0;
- SELECT @lastIRCode = MAX(IRCode) FROM tbRate_non;
- INSERT INTO tbRate_non(IRCode,CoCode,EffectiveDate,EngName,Age,MalePremium,FemalePremium,Distinguish,IsStop)
- VALUES (@lastIRCode+1,'non','1970-01-01','test',0,10,10,0,0);
- -- ^^ template generating with php array
- Set Identity_Insert tbRate_non OFF;
- SELECT @ErrCnt = @@ERROR;
- IF @ErrCnt = 0
- COMMIT TRANSACTION
- ELSE
- ROLLBACK TRANSACTION;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement