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.
 
 
 
 
 

89 lines
3.6 KiB

select * from TMember$ where fmemid is null
select * from TMemberCard$ where fmemid is null
select * from TMemberCardAccount$ where Fcardid is null
select * from TMemberCoursec
--drop table TMember$
--drop table TMemberCard$
--drop table TMemberCardAccount$
--drop table TMemberCourse$
--delete from TMemberCardAccount where Fid>0
--delete from TMemberCard where Fcardid>0
--delete from TMember where fmemid>0
---更新空值
update TMember$ set FTelephone=FmemNo,FMobilePhone=FmemNo where FTelephone is null
update TMember$ set fmemid='100000' where fmemid is null
---导入会员信息
insert into TMember(FMemId,FMemNo,FName,FBriefCode,FCompId,FTypeId,FCreateDate,FBirthday,FTelephone,FMobilePhone,FMemo)
select FMemId,FMemNo,FName,FBriefCode,FCompId,FTypeId,
FCreateDate,FBirthday,FTelephone,FMobilePhone,FMemo from dbo.TMember$
---更新会员卡状态
update TMemberCard$ set Fstate=1
update TMemberCard$ set fmemid='100000' where fmemid is null
--写入会员卡
insert into TMemberCard(FCardId,FCardNo,FCardFaceNo,FTypeId,FValueType,FCompId,FMemId,FState,FCreateDate,
FSaleCompId,FSaleBillId,FMemo)
select FCardId,FCardNo,FCardFaceNo,FTypeId,FValueType,FCompId,FMemId,FState,FCreateDate,
FSaleCompId,FSaleBillId,FMemo from dbo.TMemberCard$
select Fcardno,count(Fcardno) from dbo.TMemberCard$ group by Fcardno having count(Fcardno)>1
select * from TMemberCard$ where Fcardno='880036'
----更新空值
update TMemberCardAccount$ set fmemid='100000' where fmemid is null
update TMemberCardAccount$ set FDeposit=0 where FDeposit is null
update TMemberCardAccount$ set FBalance=0 where FBalance is null
update A
set A.FCreateDate=convert(datetime,B.FCreateDate)
FROM TMemberCardAccount$ A,TMember$ B
WHERE A.FMemId = B.FMemId
---写入会员卡账户
insert into TMemberCardAccount(FId,FMemId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FRetain,FCreateDate,FMemo)
select FId,FMemId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FRetain,FCreateDate,FMemo from dbo.TMemberCardAccount$
select * from TMemberCourse$ where FCompId is null
update TMemberCourse$ set FCompId='1',FUsedPurTimes=0,FAdjustPrice=0 where FCompId is null
insert into TMemberCourse(FId,FMemId,FCourseId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FAdjustPrice,FPurchaseDate,FBizType,FTransId)
select FId,FMemId,FCourseId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FAdjustPrice,FPurchaseDate,FBizType,FTransId from TMemberCourse$
select * from dbo.TMemberOldTransHist$ where FPayment is null
select * from TMemberCard
select * from TMember
update A
set A.Fmemid=B.Fmemid
FROM TMemberOldTransHist$ A,TMember B
WHERE A.hykh = B.Fmemno
update A
set A.Fcardid=B.Fcardid
FROM TMemberOldTransHist$ A,TMemberCard B
WHERE A.hykh = B.Fcardno and A.Fmemid=B.fmemid
update TMemberOldTransHist$ set FPayment='储值卡消费'+convert(varchar(20),Famount) +'元' where Fprice>0 and Fquantity<=0
update TMemberOldTransHist$ set FPayment='消费'+convert(varchar(20),Fquantity) +'次' where Fprice<=0 and Fquantity>0
select '储值卡消费'+convert(varchar(20),Famount) +'元' from TMemberOldTransHist$ where Fprice<=0 and Fquantity>0
update TMemberOldTransHist$ set FPayment='' where FPayment is null
update TMemberOldTransHist$ set Fquantity=0 where Fquantity is null
insert into TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,
FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
select FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,
FQuantity,FAmount,FPayment,'','' from dbo.TMemberOldTransHist$