You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
sql-tools/批量更新开卡续卡支付明细和交易历史.sql

33 lines
1.0 KiB

DECLARE @BillId BIGINT
DECLARE @CompId BIGINT
DECLARE @BizType VARCHAR(10)
DECLARE @Dues DECIMAL(18,6)
DECLARE @BillMemo VARCHAR(MAX)
DECLARE @BillType VARCHAR(MAX)
DECLARE @BillTime DATETIME
DECLARE @BillNo VARCHAR(max)
DECLARE @MemId BIGINT
DECLARE @MemNo VARCHAR(max)
DECLARE Cur CURSOR FOR SELECT FBillId ,FCompId,FBizType,FDues,FBillTime,FBillMemo,FMemId,FMemNo,FBillNo
FROM TMemberSaleBill
WHERE FState = 1
OPEN Cur
FETCH Cur INTO @BillId,@CompId,@BizType,@Dues,@BillTime,@BillMemo,@MemId,@BillMemo,@BillNo
WHILE @@FETCH_STATUS=0
BEGIN
PRINT @BillId
DECLARE @Sql VARCHAR(MAX)
EXEC PAuditMemberSaleDetailSplit @BillId,@CompId, @BizType ,@Dues
EXEC PAuditMemberSaleTransHist @BillId ,@CompId,@BillNo,@BillTime ,'KK' ,@BizType,@MemId ,@MemNo,@BillMemo
EXEC (@sql)
FETCH Cur INTO @BillId,@CompId,@BizType,@Dues,@BillTime,@BillMemo,@MemId,@BillMemo,@BillNo
END
CLOSE CUR
DEALLOCATE CUR