Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. -- start transaction
  2. BEGIN TRANSACTION
  3. DECLARE @ErrCnt int=0;
  4. SET Identity_Insert tbRate_non ON;
  5.  
  6. -- vv template generating with php array, take (@lastIRCode,'non','1970-01-01','test',0,10,10,0,0) for example
  7. DECLARE @lastIRCode int=0; -- re-assined 0 for every row in excel row array
  8. DELETE FROM tbRate_non WHERE CoCode='non' AND EffectiveDate='1970-01-01' AND EngName='test' AND Age=0;
  9. SELECT @lastIRCode = MAX(IRCode) FROM tbRate_non;
  10. INSERT INTO tbRate_non(IRCode,CoCode,EffectiveDate,EngName,Age,MalePremium,FemalePremium,Distinguish,IsStop)
  11. VALUES (@lastIRCode+1,'non','1970-01-01','test',0,10,10,0,0);
  12. -- ^^ template generating with php array
  13.  
  14.  
  15. Set Identity_Insert tbRate_non OFF;
  16. SELECT @ErrCnt = @@ERROR;
  17. IF @ErrCnt = 0
  18. COMMIT TRANSACTION
  19. ELSE
  20. ROLLBACK TRANSACTION;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement