#2
mywisdom882017-11-11 21:40
|
declare @SHEET_NO varchar(18)
set @SHEET_NO ='XD0000021711100003';
INSERT INTO t_rm_vip_stored
(SHEET_NO,BRANCH_NO,CUST_NO,CUST_NAME,TEL_NO,SERVER_NO,SERVER_NAME,TOT_NUM,TOT_MONEY,REAL_MONEY,FAV_MONEY,RET_NUM,OPER_OPER,OPER_DATE,SERVER_TYPECODE,MEMO,VOLID_DATE,STORED_FLAG,PAY_WAY,CARD_NO,VIP_ID,MONTH_COUNT)
select
@SHEET_NO+1,'000001',mobile,vip_name,mobile, '1','10送','11','100.00','100.00','0.00', save_amt,'1001','2017-11-10 21:17:29.827','02','','2017-11-10 21:15:30.863','0','RMB','', mobile,NULL
from t_rm_vip_info where card_type='01' and save_amt>'0'
我想从表t_rm_vip_info中抽出mobile,vip_name ,save_amt字段配合固定值插入到表t_rm_vip_stored 中,插入的的时候@SHEET_NO自动加1 XD0000021711100003这个是单据号,在表里是不允许重复 ,现在就是向插入的时候XD000002171110不变 后面开始从0003递增