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/导出A8会员.sql

100 lines
3.0 KiB

use wuhan_yuyuan
SELECT * FROM TMemberTransHist
SELECT A.FId AS ID,
A.FMemId AS ID,
CONVERT(VARCHAR,FTime,120) as ,
CASE FBizType
WHEN 'Item' THEN '消费项目'
WHEN 'Goods' THEN '购买产品'
WHEN 'CardSale' THEN '储值卡开卡'
WHEN 'CardRchg' THEN '储值卡充值'
WHEN 'CourseSale' THEN '疗程销售'
WHEN 'Repay' THEN '还款'
ELSE FBizType END AS ,
FTransNo as ,
FContentText AS ,
wuhan_yuyuan.dbo.FNNumToStr(FQuantity) AS ,
wuhan_yuyuan.dbo.FNNumToStr(FAmount) AS ,
FPayment AS ,
FEmployee AS
INTO TImpMemberTransHist
FROM wuhan_yuyuan..TMemberTransHist AS A
WHERE FMemId IN(SELECT FMemId FROM wuhan_yuyuan..TMember WHERE FDeleted = 0)
SELECT FMemId AS ID,
FMemNO AS ,
FName AS ,FMobilePhone AS ,
CONVERT(VARCHAR,FCreateDate,23) as ,
FBirthdayType AS ,
ISNULL(CONVERT(VARCHAR,FBirthday,23),'') AS ,
dbo.FNNumToStr( FPoint) as ,FMemo AS
INTO TImpMember
FROM TMember
WHERE FDeleted = 0
SELECT A.FCardId AS Id,A.FCardNo AS ,T.FNo AS ,T.FName AS ,FMemId AS ID,
CASE WHEN A.FState = 4 THEN '停用' WHEN A.FState = 32 THEN '挂失' ELSE '正常' END AS ,
CONVERT(VARCHAR,A.FCreateDate,23) as ,
CONVERT(VARCHAR,A.FExpiredDate,23) as ,
FMemo AS
INTO TImpMemberCard
FROM TMemberCard AS A,TMemberCardType AS T
WHERE A.FTypeId = T.FId
AND A.FDeleted = 0
SELECT A.FCardId AS Id,T.FName AS ,dbo.FNNumToStr(A.FBalance) AS , dbo.FNNumToStr(A.FArrear) AS
INTO TImpMemberCardAccount
FROM TMemberCardAccount AS A,TPayAccount AS T
WHERE A.FCardId IN(SELECT FCardId FROM TMemberCard WHERE FDeleted = 0)
AND T.FId = A.FAcctId
AND( A.FBalance > 0 OR A.FArrear > 0 )
SELECT * FROM TMemberCourse
SELECT A.FId AS ID,
A.FMemId AS ID,
C.FName AS ,
I.FName AS ,
dbo.FNNumToStr(A.FPurTimes )AS ,
dbo.FNNumToStr(A.FRemainPurTimes) AS ,
dbo.FNNumToStr(A.FFreeTimes) AS ,
dbo.FNNumToStr(A.FRemainFreeTimes) AS ,
dbo.FNNumToStr(A.FPurAmount) AS ,
dbo.FNNumToStr(A.FRemainPurAmount) AS ,
dbo.FNNumToStr(A.FFreeAmount) ,
dbo.FNNumToStr(A.FRemainFreeAmount) AS ,
CONVERT(VARCHAR,A.FPurchaseDate,23) as ,
CONVERT(VARCHAR,A.FExpiredDate,23) as ,
A.FMemo AS
INTO TImpMemberCourse
FROM TMemberCourse AS A,TCourse AS C,TItem AS I
WHERE A.FItemId = I.FId
AND A.FCourseId = C.FId
AND A.FDeleted = 0
SELECT * FROM TMemberArrear
WHERE FRemainArrear > 0
use YuYuan
SELECT * INTO TImpMember FROM WuHan_YuYuan..TImpMember
SELECT * INTO TImpMemberCard FROM WuHan_YuYuan..TImpMemberCard
SELECT * INTO TImpMemberCardAccount FROM WuHan_YuYuan..TImpMemberCardAccount
SELECT * INTO TImpMemberTransHist FROM WuHan_YuYuan..TImpMemberTransHist
SELECT * INTO TImpMemberCourse FROM WuHan_YuYuan..TImpMemberCourse
create database YuYuan
SELECT * FROM TImpMemberCourse