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.
805 lines
22 KiB
805 lines
22 KiB
Use ChongQing_QiPin
|
|
|
|
SP_RENAME 'TImpMember','TImpMember_CD123'
|
|
SP_RENAME 'TIMpCard','TIMpCard_CD123'
|
|
SP_RENAME 'TImpCourse','TImpCourse_CD123'
|
|
SP_RENAME 'TImpHist','TImpHist_CD123'
|
|
|
|
select * from TIMpCard WHERE VIPZTBJ != 'Õý³£'
|
|
|
|
DELETE TImpMember
|
|
DELETE TIMpCard
|
|
DELETE TImpCourse
|
|
DELETE TImpHist
|
|
|
|
|
|
TRUNCATE table TImpMember
|
|
TRUNCATE table TImpCard
|
|
TRUNCATE table TImpCourse
|
|
TRUNCATE table TImpHist
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
SELECT * FROM TImpCourse WHERE LCSSKH ='QP000113'
|
|
SELECT * FROM TImpHist
|
|
|
|
SELECT * FROM TImpCard WHERE VIPSSKH = 'QP048863'
|
|
|
|
KHBM00,KHMDBM,KHDJRQ,KHDERMC,KHXM00,decode(KHXB00,'M','ÄÐ','F','Å®')KHXB00,KHZW00,KHJRFS,KHSFZH,KHSR00,KHDH00, "
|
|
+ " KHSJ00,KHJFS0,KHBZ00,KHMDMC,KHTJRMC,KHLX00
|
|
|
|
|
|
|
|
SP_RENAME 'TimpCard','TimpCard_'
|
|
|
|
SELECT count(1) FROM TImpMember
|
|
SELECT count(1) FROM TIMpCard
|
|
SELECT count(1) FROM TImpCourse
|
|
SELECT count(1) FROM TImpHist
|
|
|
|
|
|
|
|
|
|
|
|
--³õʼ»¯
|
|
ALTER TABLE TImpMember ADD FMemId BIGINT
|
|
ALTER TABLE TImpMember ADD FMemNo VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FName VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FGender INT
|
|
ALTER TABLE TImpMember ADD FMobile VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpMember ADD FExpiredDate DATETIME
|
|
ALTER TABLE TImpMember ADD FCompId BIGINT
|
|
ALTER TABLE TImpMember ADD FMemo VARCHAR(1000)
|
|
ALTER TABLE TImpMember ADD FArrear DECIMAL(18,6)
|
|
ALTER TABLE TImpMember ADD FPoint DECIMAL(18,6)
|
|
ALTER TABLE TImpMember ADD FBirthday DATETIME
|
|
ALTER TABLE TImpMember ADD FBirthdayType CHAR
|
|
ALTER TABLE TImpMember ADD FDeleted BIT
|
|
|
|
|
|
ALTER TABLE TImpCard ADD FCardNo VARCHAR(50)
|
|
ALTER TABLE TImpCard ADD FCardTypeId BIGINT
|
|
ALTER TABLE TImpCard ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpCard ADD FExpiredDate DATETIME
|
|
ALTER TABLE TImpCard ADD FCompId BIGINT
|
|
ALTER TABLE TImpCard ADD FMemo VARCHAR(1000)
|
|
ALTER TABLE TImpCard ADD FBalance DECIMAL(18,6)
|
|
ALTER TABLE TImpCard ADD FMemId BIGINT
|
|
ALTER TABLE TImpCard ADD FCardId BIGINT
|
|
ALTER TABLE TImpCard ADD FPoint DECIMAL(18,6) DEFAULT 0
|
|
|
|
ALTER TABLE TImpCourse ADD FId BIGINT
|
|
ALTER TABLE TImpCourse ADD FCourseId BIGINT
|
|
ALTER TABLE TImpCourse ADD FRemainTimes DECIMAL(18,6)
|
|
ALTER TABLE TImpCourse ADD FUsedPurTimes DECIMAL(18,6)
|
|
ALTER TABLE TImpCourse ADD FPurAmount DECIMAL(18,6)
|
|
ALTER TABLE TImpCourse ADD FCompId BIGINT
|
|
ALTER TABLE TImpCourse ADD FItemId BIGINT
|
|
ALTER TABLE TImpCourse ADD FMemId BIGINT
|
|
ALTER TABLE TImpCourse ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpCourse ADD FExpiredDate DATETIME
|
|
ALTER TABLE TImpCourse ADD FPurTimes DECIMAL(18,6)
|
|
ALTER TABLE TImpCourse ADD FAdjustPrice DECIMAL(18,6)
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
SELECT FName,FZDName FROM TCompany
|
|
|
|
UPDATE TCompany SET FZDName = FName WHERE FZDName IS NULL
|
|
|
|
SELECT * FROM TImpMember
|
|
WHERE FCompId IS NULL
|
|
|
|
|
|
|
|
UPDATE A
|
|
SET A.FCompId = B.FId
|
|
FROM TImpMember AS A,TCompany AS B
|
|
WHERE A.KHMDMC = B.FZDName
|
|
|
|
SELECT COUNT(1) FROM TImpMember
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCompId IS NULL
|
|
SELECT * FROM TImpMember WHERE ISNULL(VIPKH00,'') != ''
|
|
SELECT * FROM TImpMember WHERE VIPKH00 != KHBM00
|
|
SELECT * FROM TImpMember WHERE VIPBM00 = ''
|
|
SELECT * FROM TImpMember WHERE VIPBM00 = ''
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = REPLACE(REPLACE(KHBM00,'QP','99'),'CQ','98') WHERE KHBM00 != ''
|
|
|
|
SELECT * FROM TImpMember WHERE VIPBM00 < 'Q' AND VIPBM00 > '9'
|
|
SELECT * FROM TImpMember WHERE FGender = 1
|
|
SELECT * FROM TImpMember WHERE ISNULL(FMemNo,'') = ''
|
|
|
|
UPDATE TImpMember SET FDeleted =0
|
|
UPDATE TImpMember SET FDeleted = 1 WHERE KHBM00 NOT IN(SELECT VIPSSKH FROM TIMpcARD)
|
|
|
|
UPDATE TImpMember SET FMemNo = ISNULL(FMemNo,KHBM00)
|
|
|
|
UPDATE A SET A.FMemNo = B.VIPKH00
|
|
FROM TImpMember AS A,TImpCard AS B
|
|
WHERE B.VIPSSKH = A.KHBM00
|
|
|
|
SELECT * FROM TImpMember WHERE KHBM00 NOT IN(SELECT VIPSSKH FROM TIMpcARD)
|
|
|
|
UPDATE TImpMember SET FName = KHXM00
|
|
UPDATE TImpMember SET FMobile =KHSJ00
|
|
UPDATE TImpMember SET FGender = CASE WHEN KHXB00 = 'ÄÐ' THEN 1 ELSE 0 END
|
|
UPDATE TImpMember SET FCreateDate = KHDJRQ
|
|
UPDATE TImpMember SET FArrear = 0
|
|
UPDATE TImpMember SET FMemo = ±¸×¢
|
|
UPDATE TImpMember SET FPoint = Ä¿Ç°»ý·Ö
|
|
|
|
UPDATE TImpMember SET FBirthdayType = 'G'
|
|
UPDATE TImpMember SET FBirthdayType = 'L'
|
|
|
|
UPDATE TImpMember SET KHSR00 = '9999' + SUBSTRING(KHSR00,5,19) WHERE KHSR00 < '1753-01-01'
|
|
UPDATE TImpMember SET KHSR00 = NULL WHERE KHSR00 = '0001-01-01 00:00:00'
|
|
UPDATE TImpMember SET FBirthday = KHSR00 WHERE KHSR00 > '1753-01-01'
|
|
|
|
SELECT * FROM TMember
|
|
|
|
|
|
SELECT * FROM TImpCard
|
|
|
|
UPDATE A
|
|
SET A.FCompId = B.FId
|
|
FROM TImpCard AS A,TCompany AS B
|
|
WHERE A.VIPMDMC = B.FZDName
|
|
|
|
SELECT * FROM TImpCard
|
|
WHERE FCompId IS NULL
|
|
|
|
|
|
SELECT * FROM TImpCard
|
|
WHERE FMemId IS NULL
|
|
|
|
UPDATE TImpCard SET FCardId = REPLACE(REPLACE(VIPBM00,'QP','99'),'CQ','98') WHERE VIPBM00 != ''
|
|
|
|
SELECT * FROM TImpCard WHERE VIPBM00 > '9'
|
|
|
|
UPDATE TImpCard SET FCardId = VIPBM00
|
|
UPDATE TImpCard SET FCardNo = VIPKH00
|
|
|
|
SELECT count(1) from TImpCard WHERE FPoint IS NULL
|
|
|
|
SELECT * FROM TMember WHERE FPoint != 0
|
|
|
|
SELECT * FROM TMemberSaleBill WHERE FBillNo = '0231101606040001'
|
|
|
|
SELECT * FROM TMemberPointHist WHERE FMemId = 5090427578933876296
|
|
|
|
CREATE INDEX IX_IMP_CARD ON TImpCard(VIPBM00)
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId
|
|
FROM TImpCard AS A,TImpMember AS B
|
|
WHERE A.VIPSSKH = B.KHBM00
|
|
AND A.FMemId IS NULL
|
|
|
|
|
|
SELECT * FROM TImpCard WHERE FMemId IS NULL
|
|
|
|
SELECT * FROM TImpCard WHERE KHSJ00 ='13657690518'
|
|
|
|
SELECT * FROM TImpCard WHERE VIPSSKH NOT IN(SELECT VIPBM00 FROM TImpMember)
|
|
|
|
SELECT * FROM TImpMember WHERE VIPBM00 = 'QP048863'
|
|
SELECT count(*) FROM TImpMember WHERE KHBM00 = 'QP048863'
|
|
|
|
SELE
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMobile = '13657690518'
|
|
SELECT * FROM TImpMember WHERE KHSJ00 = '13657690518'
|
|
SELECT * FROM TImpCard WHERE KHSJ00 = '13657690518'
|
|
|
|
SELECT * FROM TImpCard WHERE VIPSSKH = 'QP036150'
|
|
SELECT * FROM TImpCard WHERE VIPKH00 = 'QG00009555'
|
|
|
|
|
|
|
|
SELECT VIPBM00,SUM(1) FROM TImpMember
|
|
GROUP BY VIPBM00
|
|
ORDER BY SUM(1)
|
|
|
|
SELECT count(1) FROM TImpMember WHERE VIPBM00 != ''
|
|
SELECT * FROM TImpMember WHERE KHSJ00 = '13436141028'
|
|
|
|
SELECT * FROM TImpCard WHERE VIPSSKH = '277201501251820525'
|
|
|
|
UPDATE TImpCard SET FCreateDate = VIPDJRQ
|
|
UPDATE TImpCard SET FExpiredDate = DATEADD(YEAR,100,FCreateDate)
|
|
|
|
UPDATE TImpCard SET FMemo = VIPBZ01
|
|
|
|
|
|
UPDATE A SET A.FCardTypeId = B.FId
|
|
FROM TImpCard AS A,TMemberCardType AS B
|
|
WHERE B.FName = A.VIPKLX0
|
|
|
|
SELECT * FROM TImpCard WHERE FCardTypeId IS NULL
|
|
|
|
SELECT VIPBZ01
|
|
|
|
SELECT * FROM TMemberCardTYPE
|
|
|
|
UPDATE TImpCard SET FBalance = VIPKNYE
|
|
|
|
SELECT * FROM TImpCard
|
|
|
|
--´Ó»áÔ±ÁƳ̵¼ÈëÁƳÌ×ÊÁÏ
|
|
|
|
SELECT LCXMBM,LCXMMC, XMNBBM
|
|
FROM TImpCourse AS A
|
|
WHERE FCourseId IS NULL
|
|
GROUP BY LCXMBM,LCXMMC, XMNBBM
|
|
|
|
|
|
|
|
--ÁƳÌ
|
|
INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
|
|
SELECT dbo.FNNewId() AS FId,
|
|
I.FNo + 'L1' AS FNo,
|
|
I.FName + '-' + 'ÁƳÌ1' AS FName,
|
|
'' AS FBriefCode,
|
|
I.FId AS FItemId,
|
|
0 AS FPackId,
|
|
1 AS FSequence,
|
|
(SELECT TOP 1 FId FROM TBasicType WHERE FKey = 'CourseType') AS FTypeId,
|
|
1 AS FTimes,
|
|
0 AS FFreeTimes,
|
|
0 AS FDurable,
|
|
0 AS FValidityPeriodUnit,
|
|
0 AS FValidityPeriod,
|
|
getdate() AS FCreateDate,
|
|
NULL AS FExpiredDate,
|
|
'' AS FDescription,
|
|
1 AS FEnabled,
|
|
I.FPrice AS FPrice,
|
|
I.FPrice AS FAmount,
|
|
1 AS FCalcMode
|
|
FROM TItem AS I
|
|
WHERE (FNo IN(SELECT XMNBBM FROM TImpCourse) OR FName IN (SELECT LCXMMC FROM TImpCourse))
|
|
AND FId NOT IN(SELECT FItemId FROM TCOurse)
|
|
|
|
|
|
SELECT * FROM TImpCourse WHERE ISNULL(FMemId,0) = 0
|
|
|
|
SELECT * FROM TImpCard WHERE FCardNo = 'QG00015092'
|
|
|
|
SELECT * FROM TImpCourse WHERE FCourseId IS NULL
|
|
SELECT LCXMMC FROM TImpCourse WHERE FCourseId IS NULL
|
|
GROUP BY LCXMMC
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId,
|
|
A.FCompId = B.FCompId
|
|
FROM TImpCourse AS A,TImpCard AS B
|
|
WHERE A.LCSSKH = B.vipkh00
|
|
AND A.FMemId IS NULL
|
|
|
|
|
|
|
|
UPDATE TImpCourse SET FMemId = null
|
|
|
|
|
|
select * from TIMPmEMBER WHERE FName = 'ÀîçùÈØ'
|
|
|
|
SELECT * FROM TItem WHERE Fid= 610
|
|
SELECT * FROM TItem WHERE FNo = '487'
|
|
|
|
SELECT * FROM TImpItem WHERE XMMC00 LIKE '%±ùÇò%'
|
|
|
|
SELECT * FROM TImpCourse WHERE FMemId IS NULL AND LCSSKH IN (SELECT vipkh00 FROM TIMPCard)
|
|
|
|
AND LCSSBM IN(SELECT FCardId FROM TImpCard)
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo = 'CD003752'
|
|
|
|
317201604122356065
|
|
|
|
SELECT * FROM TImpCard WHERE VIPKH00 = 'CD003752'
|
|
|
|
SELECT * FROM TItem WHERE FName like '%£¨Ã沿£©Í·²¿²¦½î%'
|
|
|
|
SELECT * FROM TImpCourse
|
|
|
|
SELECT lcbm00 ,SUM(1)
|
|
FROM TImpCourse
|
|
GROUP BY lcbm00
|
|
ORDER BY SUM(1) DESC
|
|
|
|
UPDATE TImpCourse SET FId = right(REPLACE(REPLACE(lcbm00,'QP','99'),'CQ','98'),19)
|
|
|
|
SELECT * FROM TImpCourse WHERE lcbm00 > '9'
|
|
|
|
select len(dbo.FNNewId())
|
|
|
|
UPDATE TImpCard SET LCSSBM = REPLACE(REPLACE(LCSSBM,'QP','99'),'CQ','98') WHERE VIPBM00 != ''
|
|
|
|
SELECT COUNT(1) FROM TImpCourse
|
|
|
|
UPDATE
|
|
--񅧏
|
|
UPDATE A
|
|
SET A.FCourseId = C.FId,
|
|
A.FItemId = C.FItemId
|
|
FROM TImpCourse AS A,TItem AS B,TCourse AS C
|
|
WHERE A.XMNBBM = B.FNo
|
|
AND C.FItemId = B.FId
|
|
AND A.FItemId IS NULL
|
|
|
|
UPDATE A
|
|
SET A.FItemID = B.FItemId,
|
|
A.FCourseId = B.FCourseId
|
|
FROM TMemberCourse AS A,TImpCourse AS B
|
|
WHERE A.FId = B.FId
|
|
AND A.FItemId = 0
|
|
AND B.FItemId != 0
|
|
|
|
|
|
UPDATE A
|
|
SET A.FCourseId = C.FId,
|
|
A.FItemId = C.FItemId
|
|
FROM TImpCourse AS A,TItem AS B,TCourse AS C
|
|
WHERE A.LCXMMC = B.FName
|
|
AND C.FItemId = B.FId
|
|
AND ISNULL(A.FItemId,0) = 0
|
|
|
|
|
|
SELECT * FROM TImpCourse WHERE XMNBBM NOT IN(SELECT FNo FROM TItem)
|
|
|
|
--񅧏
|
|
UPDATE A
|
|
SET A.FCourseId = C.FId,
|
|
A.FItemId = C.FItemId
|
|
FROM TImpCourse AS A,TItem AS B,TCourse AS C
|
|
WHERE A.LCXMMC LIKE '%' + B.FName + '%'
|
|
AND C.FItemId = B.FId
|
|
AND ISNUA.FItemId IS NULL
|
|
|
|
SELECT * FROM TItem WHERE FNo = '488'
|
|
|
|
|
|
UPDATE TImpCourse SET FId = dbo.FNNewId()
|
|
|
|
SELECT * FROM TImpCourse WHERE ISNULL(FItemId,0) = 0
|
|
NULL
|
|
GROUP BY LCXMMC
|
|
|
|
SELECT * FROM TImpCourse WHERE LCXMBM = '610'
|
|
|
|
SELECT * FROM TImpCourse WHERE LCSSKH = 'MA00138'
|
|
|
|
SELECT * FROM TItem WHERE FNo = '487'
|
|
|
|
--´ÎÊý
|
|
UPDATE TImpCourse SET FPurTimes = LCXMCS
|
|
UPDATE TImpCourse SET FUsedPurTimes = CAST(LCXMCS AS FLOAT) - CAST(LCCS00 AS FLOAT)
|
|
|
|
UPDATE TImpCourse SET FPurAmount =
|
|
CASE WHEN CAST(LCCS00 AS FLOAT) = 0 THEN 0 ELSE (CAST(LCXMJE AS DECIMAL(18,6)) / CAST(LCCS00 AS FLOAT)) * CAST(LCXMCS AS FLOAT) END
|
|
WHERE CAST(LCCS00 AS FLOAT) > 0
|
|
|
|
|
|
UPDATE TImpCourse SET FAdjustPrice =
|
|
CASE WHEN CAST(LCCS00 AS FLOAT) = 0 THEN 0
|
|
ELSE (CAST(LCXMJE AS DECIMAL(18,6)) / CAST(LCCS00 AS FLOAT)) END
|
|
WHERE CAST(LCCS00 AS FLOAT) > 0
|
|
|
|
UPDATE A
|
|
SET A.FCreateDate = B.FCreateDate
|
|
FROM TImpCourse AS A,TImpCard AS B
|
|
WHERE A.FMemId = B.FMemId
|
|
UPDATE TImpCourse SET FExpiredDate = DATEADD(YEAR,1,FCreateDate)
|
|
|
|
|
|
|
|
--½»Ò×ÀúÊ·
|
|
ALTER TABLE TImpHist ADD FTime DATETIME
|
|
ALTER TABLE TImpHist ADD FId BIGINT
|
|
ALTER TABLE TImpHist ADD FMemId BIGINT
|
|
ALTER TABLE TImpHist ADD FCardId BIGINT
|
|
ALTER TABLE TImpHist ADD FCompId BIGINT
|
|
ALTER TABLE TImpHist ADD FBizType VARCHAR(30)
|
|
ALTER TABLE TImpHist ADD FContent VARCHAR(1000)
|
|
ALTER TABLE TImpHist ADD FAmount DECIMAL(18,6)
|
|
ALTER TABLE TImpHist ADD FTransNo VARCHAR(1000)
|
|
|
|
|
|
SELECT * FROM TImpHist
|
|
|
|
|
|
|
|
SELECT MDMC FROM TImpHist WHERE FCompId IS NULL
|
|
GROUP BY
|
|
MDMC
|
|
|
|
UPDATE A
|
|
SET A.FCompId = B.FId
|
|
FROM TImpHist AS A,TCompany AS B
|
|
WHERE B.FZDNAME LIKE '%' + A.MDMC + '%'
|
|
|
|
|
|
UPDATE TImpHist SET FCompId = 1 WHERE MDMC = '×ܲ¿'
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId,
|
|
A.FCardId = B.FCardId
|
|
FROM TImpHist AS A,TImpCard AS B
|
|
WHERE A.RZVIPID = B.vipbm00
|
|
|
|
SELECT * FROM TImpHist
|
|
|
|
SELECT * FROM TImpHist WHERE RIGHT(REPLACE(RZBM00,'RZ','98'),19) = '0130629141240265121'
|
|
|
|
UPDATE TImpHist SET FTime = RZDJRQ
|
|
|
|
SELECT RIGHT(REPLACE(RZBM00,'RZ','98'),19),SUM(1)
|
|
FROM TIMpHist GROUP BY RIGHT(REPLACE(RZBM00,'RZ','98'),19) HAVING(SUM(1) > 1)
|
|
|
|
|
|
|
|
UPDATE TImpHist SET FId = dbo.FNNewId()
|
|
|
|
UPDATE TImpHist SET FBizType = ISNULL(RZVIPZH,'') + '.' + RZLX00
|
|
|
|
UPDATE TImpHist SET FContent =ISNULL( RZBZ00,'')
|
|
|
|
UPDATE TImpHist SET FAmount = RZXFJE
|
|
|
|
UPDATE TImpHist SET FTransNo = RZDH00
|
|
|
|
SELECT FBizType FROM TImpHist WHERE
|
|
|
|
|
|
SELECT * FROM TImpHist WHERE RZBM00 > '9'
|
|
|
|
|
|
--µ¼»áÔ±
|
|
|
|
INSERT INTO TMember(
|
|
FMemId,
|
|
FMemNo,
|
|
FName,
|
|
FBriefCode,
|
|
FTypeId,
|
|
FCompId,
|
|
FCreateDate,
|
|
FGender,
|
|
FBirthdayType,
|
|
FBirthday,FTelephone,FMobilePhone,FQQ,FWeChat,FIdCard,FEmail,FAddress,FProId,FCPW,FQPW,
|
|
FChargeEmpId,FPoint,FRecvConsSMS,FRecvBulkSMS,FMemo,FCustom1,FCustom2,FCustom3,FCustom4,FCustom5)
|
|
SELECT FMemId AS FMemId,
|
|
FMemNo AS FMemNo,
|
|
FName AS FName,
|
|
dbo.FNGetFirstPinYin(FName),
|
|
0 AS FTypeId,
|
|
FCompId AS FCompId,
|
|
ISNULL(FCreateDate ,'1900-01-01') AS FCreateDate,
|
|
FGender AS FGender,
|
|
FBirthdayType AS FBirthdayType,
|
|
FBirthday AS FBirthday,
|
|
'' AS FTelephone,
|
|
ISNULL(FMobile,'') AS FMobilePhone,
|
|
'' AS FQQ,
|
|
'' AS FWeChat,
|
|
'' AS FIdCard,
|
|
'' AS FEmail,
|
|
'' AS FAddress,
|
|
0 AS FProId,
|
|
'' AS FCPW,
|
|
'' AS FQPW,
|
|
0 AS FChargeEmpId,
|
|
ISNULL( FPoint,0) AS FPoint,
|
|
1 AS FRecvConsSMS,
|
|
1 AS FRecvBulkSMS,
|
|
ISNULL(FMemo,'') AS FMemo,
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
from TImpMember
|
|
WHERE ISNULL(FDeleted,0)!= 1
|
|
|
|
select KHMDMC FROM TImpMEMBER WHERE FCompId IS NULL
|
|
GROUP BY KHMDMC
|
|
|
|
SELECT FMemNo,SUM(1) FROM TImpmember GROUP BY FMemNo
|
|
ORDER BY SUM(1) desc
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo = 'QE01732 '
|
|
|
|
UPDATE
|
|
|
|
UPDATE TImpMember SET FMemNo = FMemNo + '.1' WHERE KHBM00 = 'QP047998'
|
|
|
|
UPDATE TImpCard SET FCardNo = FCardNo + '.1' WHERE VIPBM00 = 'QP046499'
|
|
UPDATE TImpCard SET FCardNo = FCardNo + '.1' WHERE VIPBM00 = 'QP050052'
|
|
UPDATE TImpCard SET FCardNo = FCardNo + '.1' WHERE VIPBM00 = 'QP74377'
|
|
|
|
ALTER TABLE TImpMember ADD FFlag BIT
|
|
|
|
UPDATE TImpmember SET FFlag = 1 WHERE FMemNo in('D006775','DZ016890','QE01732 ');
|
|
|
|
SELECT * FROM TImpCard WHERE FCardNo = 'QE01732'
|
|
SELECT * FROM TImpCard WHERE VIPSSKH = 'QP74377'
|
|
QP050052
|
|
|
|
|
|
SELECT FCardNo,SUM(1) FROM TImpCard GROUP BY FCardNo
|
|
ORDER BY SUM(1) desc
|
|
|
|
|
|
|
|
WHERE FMemNo NOT IN (SELECT FMemNo FROM TImpMember GROUP BY FMemNo HAVING(COUNT(1) > 1))
|
|
|
|
SELECT FMemNo,SUM(1) FROM TImpMember GROUP BY FMemNo HAVING(COUNT(1) > 1)
|
|
|
|
SELECT VIPZTBJ FROM TImpCard
|
|
GROUP BY VIPZTBJ
|
|
|
|
ALTER TABLE TImpCard ADD FState INT
|
|
UPDATE TImpCard SET FState = 1
|
|
UPDATE TImpCard SET FState = 5 WHERE VIPZTBJ = '¹Òʧ'
|
|
UPDATE TImpCard SET FState = 4 WHERE VIPZTBJ = '´ýÈ·ÈÏ'
|
|
|
|
UPDATE TImpCard SET FState = 1
|
|
|
|
--¿Éµ¼¿¨
|
|
|
|
UPDATE A
|
|
SET A.FCompId = B.FCompId
|
|
FROM TIMpMEMBER AS A,TImpCard AS B
|
|
WHERE A.FCompId = B.FCOmpId
|
|
|
|
UPDATE TCompany SET FZDName = FName WHERE FNo LIKE 'Z%'
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
FCardId,
|
|
FCardNo,
|
|
FCardFaceNo,
|
|
FTypeId,
|
|
FValueType,
|
|
FCompId,
|
|
FMemId,
|
|
FState,
|
|
FCreateDate,
|
|
FExpiredDate,
|
|
FTotalTimes,
|
|
FUsedTimes,
|
|
FSaleCompId,
|
|
FSaleBillId,
|
|
FMemo)
|
|
SELECT
|
|
FCardId AS FId,
|
|
FCardNo AS FNo,
|
|
FCardNo AS FFaceNo,
|
|
FCardTypeId AS FTypeId,
|
|
(SELECT FValueType FROM TMemberCardType WHERE FId = FCardTypeId) AS FValueType,
|
|
FCompId AS FCompId,
|
|
FMemId AS FMemId,
|
|
FState AS FState,
|
|
ISNULL(FCreateDate,1900) AS FCreateDate,
|
|
DATEADD(year,100, ISNULL(FCreateDate,2000)) AS FExpiredDate,
|
|
0 AS FTotalTimes,
|
|
0 AS FUsedTimes,
|
|
FCompId AS FSaleCompId,
|
|
0 AS FSaleBillId,
|
|
ISNULL(FMemo,'') AS FMemo
|
|
FROM TImpCard
|
|
|
|
WHERE FCompId is null
|
|
|
|
WHERE FCardNo NOT IN (SELECT FMemNo FROM TImpMember GROUP BY FMemNo HAVING(COUNT(1) > 1))
|
|
|
|
|
|
|
|
AND FMemId IS NOT NULL
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,DATEADD(year,1, FCreateDate) AS FExpiredDate,''
|
|
FROM TImpCard AS A
|
|
WHERE FCardId IN(SELECT FCardId FROM TMemberCard)
|
|
|
|
|
|
|
|
INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
select dbo.FNNewId(),A.FMemId,A.FCardId,3,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'´ÓÀÏϵͳµ¼Èë'
|
|
FROM TImpCard AS A
|
|
WHERE FCardId IN(SELECT FCardId FROM TMemberCard)
|
|
|
|
|
|
|
|
--½»Ò×ÀúÊ·
|
|
|
|
SELECT * FROM TImpHist WHERE FMemId IS NULL
|
|
|
|
INSERT TMemberOldTransHist(FId,FCompId,FMemId,FTime,FCardId,FBIllType,FBizType,FTransNo,FCOntent,FPrice,FQuantity,FAmount,FPayment,Femployee,FMemo)
|
|
SELECT FId,FCompId,FMemId,ISNULL(FTime,'1753-01-01'),FCardId,'',FBizType,ISNULL(FTransNo,'') AS FTransNo,ISNULL(FCOntent,''),FAmount,1,FAmount,ISNULL('',''),'', '' AS FMemo
|
|
FROM TImpHist
|
|
WHERE FMemId IS NOT NULL
|
|
|
|
SELECT * FROM TImpCard WHERE FCardNo = 'QC00001697'
|
|
|
|
|
|
SELECT count(1) FROM TImpHist WHERE FMemId IS NULL
|
|
|
|
TRUNCATE TABLE TImpHist
|
|
|
|
SELECT * FROM TMemberCard WHERE FCardId = 479201603141159524
|
|
|
|
SELECT * FROM TImpCourse WHERE FMemId IS NULL
|
|
|
|
--µ¼ÈëÁƳÌ
|
|
|
|
SELECT FId,sum(1) FROM TImpCourse GROUP BY FId
|
|
order by sum(1) desc
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FUsedPurTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
SELECT FId,FMemId,FCourseId,0,FItemId,FCompId,FPurTimes,ISNULL(FPurAmount,0),0,FUsedPurTimes,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'',1,ISNULL(FAdjustPrice,0)
|
|
FROM TImpCourse
|
|
--WHERE FCourseId IS NOT NULL
|
|
WHERE FMemId IS NOT NULL
|
|
|
|
AND FId NOT IN(SELECT FId FROM TMemberCourse)
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,
|
|
FPurAmount,FCompId,
|
|
FBillType,FBizType,FBillId,FBillNo,FBillDetailId)
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FId,0,FCourseId,FTime = getdate(),FPurTimes,FUsedPurTimes,0,0,
|
|
ISNULL(FPurAmount,0),FCompId,
|
|
'DR','Import',0,'',0
|
|
FROM TImpCourse
|
|
WHERE FMemId IS NOT NULL
|
|
|
|
AND FId NOT IN(SELECT FMemCourseId FROM TMemberCourseHist)
|
|
|
|
DELETE TMember WHERE FCompId NOT IN(4793138454401409076,0,1)
|
|
|
|
SELECT FMEMID INTO #Member FROM TMember WHERE FCompId NOT IN(4793138454401409076,0)
|
|
|
|
DELETE TMemberCardAcctHist WHERE FMEMID IN(SELECT FMemId FROM #Member)
|
|
DELETE TMemberCardaCCOUNT WHERE FMEMID IN(SELECT FMemId FROM #Member)
|
|
DELETE TMemberCard WHERE FMEMID IN(SELECT FMemId FROM #Member) AND FCardId != 0
|
|
DELETE TMember WHERE FMEMID IN(SELECT FMemId FROM #Member)AND FMEMID != 0
|
|
|
|
SELECT FCardId FROM
|
|
|
|
SELECT * FROM TConsumeBill WHERE FCardId IN(SELECT FCardId FROM #Member)
|
|
|
|
|
|
|
|
SELECT * FROM TImpCourse WHERE
|
|
|
|
SELECT * FROM TImpCard WHERE FCardNo = 'QA30632'
|
|
|
|
SELECT * FROM TImpCourse WHERE FMemId = 277201601171658086
|
|
|
|
SELECT * FROM TConsumeBill
|
|
|
|
SELECT * FROM TMemberSaleBill
|
|
|
|
SELECT * F
|
|
|
|
UPDATE TMemberCardAccount SET FExpiredDate = null
|
|
UPDATE TMemberSaleCard SET FOldAcctExpiredDate = null
|
|
|
|
SELECT * FROM TMemberCardAccount WHERE FExpiredDate IS NOT NULL
|
|
|
|
SELECT * FROM TMemberSaleBill
|
|
|
|
SELECT * FROM TMemberSaleCard
|
|
|
|
SELECT * FROM TSMSAccount
|
|
|
|
SELECT * FROM TMemberCardAccount
|
|
|
|
INSERT TSMSAccount(FCompId,FAccount)
|
|
SELECT FId,'913A74DF4F5F997DB0A41A287430A4F135266FE6B070985861154696B390428D724018484608BCEBDABFCEC082EB04EC96218936D3B0B6402AA72EB481262D7E60C4A5307C66A1F9D16516F78AE1D5B42AA72EB481262D7EDABFCEC082EB04EC80C3CF04366F8150E06DA6B34851151D3C7D65FA'
|
|
FROM TCompany
|
|
WHERE FId = 5061256264766092432
|
|
|
|
DELETE TSMSAccount WHERE FCompId NOT IN(
|
|
SELECT FId FROM TCompany WHERE FpARENTID = 5061256264766092432
|
|
) AND FCompId NOT IN(1)
|
|
|
|
SELECT * FROM TSystemParamSub WHERE FParamKey LIKE '%Receipt%'
|
|
|
|
ReceiptGreetingsCardSale
|
|
|
|
DELETE TSystemParamSub WHERE FParamKey LIKE '%ReceiptPaperOutMode%'
|
|
|
|
SELECT LEN('F71963A9F66EA73D52BFB5DF850E42AC')
|
|
|
|
SELECT * FROM TSMSTemplate
|
|
|
|
INSERT INTO TSMSTemplate(FCompId,FTmplId,FName,FCategory,FContent,FWeChatTemplId,FWeChatPrefix,FWeChatSuffix,FOrder)
|
|
SELECT C.FId ,FTmplId,A.FName,FCategory,FContent,FWeChatTemplId,FWeChatPrefix,FWeChatSuffix,FOrder
|
|
FROM
|
|
TSMSTemplate A,TCOMPANY AS C WHERE FCompId = 5061256264766092432
|
|
AND C.FParentId = 5061256264766092432
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FCPW = 'MD5-FFD3044D28D0DDE0EEE8A539E93391D2' WHERE FMemNo = 'QA00000508'
|
|
|
|
SELECT * FROM TMember WHERE FMemNo = 'QA00000508'
|
|
|
|
SELECT * FROM TimpPW
|
|
|
|
|
|
UPDATE A
|
|
SET A.FPW = B.VIPMM00
|
|
FROM TImpCard AS A,TImpPW AS B
|
|
WHERE A.VIPBM00 = B.VIPBM00
|
|
|
|
ALTER TABLE TImpCard ADD FPW VARCHAR(200) NOT NULL DEFAULT ''
|
|
|
|
|
|
UPDATE A
|
|
SET A.FCPW = 'MD5-' + B.FPW
|
|
FROM TMember AS A,TImpCard AS B
|
|
WHERE A.FMemID = B.FMemId
|
|
AND A.FCPW = ''
|
|
AND B.FPW != ''
|
|
|
|
SELECT * FROM TMember WHERE FCPW = 'MD5-E10ADC3949BA59ABBE56E057F20F883E'
|
|
|
|
SELECT * FROM TUser WHERE FNo = '0207001'
|
|
|
|
SELECT * FROM TMember WHERE FMemNo = '880707'
|
|
|
|
UPDATE
|
|
TMember SET FCPW = '' WHERE FCPW = 'MD5-E10ADC3949BA59ABBE56E057F20F883E'
|
|
|
|
SELECT * FROM TMember WHERE FCPW = ''
|
|
|
|
UPDATE TMemberCourse SET FExpiredDate = null
|
|
|
|
|
|
SELECT * FROM TMemberEarnestMoney \\
|
|
|
|
SELECT * FROM TMember WHERE FMemNo = 'NB000027'
|
|
|
|
SELECT * FROM TMemberCourse WHERE FMemId = 398201504261812218
|
|
|
|
SELECT * FROM TMemberCourse WHERE FItemId = 0
|
|
|
|
SELECT * FROM TImpCourse WHERE FId = 8201504261812214006
|
|
|
|
|
|
UPDATE A
|
|
SET A.FPoint = B.FPoint
|
|
FROM TMember AS A,TImpCard AS B
|
|
WHERE A.FMemId = B.FMemId
|
|
AND B.FPoint IS NOT NULL
|
|
|
|
|
|
SELECT * FROM TImpCard WHERE FPoint IS NOT NULL
|
|
|
|
SELECT * FROM TMember WHERE FPoint <> 0
|
|
|
|
INSERT TMemberPointHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FMemo,FRecordTime)
|
|
SELECT dbo.FNNewId(),A.FMemId,getdate(),0,1,'DR','Import',0,'',FPoint,0,FPoint,'',getdate()
|
|
FROM TImpCard AS A WHERE ISNULL(FPoint,0) != 0
|
|
|
|
|
|
USE ChongQing_XinChao
|
|
|
|
|
|
SELECT * FROM TBookingRequest
|
|
|
|
SELECT * FROM TBillThirdPartyPayment
|
|
|
|
SELECT * FROM TMemberCard WHERE FState = 4
|
|
|
|
SELECT * FROM TMemberCard WHERE FCardNo = 'QG0230001329'
|
|
|
|
UPDATE TMemberCard SET FState = 1 WHERE FCardNo = 'QG0230001329' |