|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT A.cardTypeCode AS FMGJNo,A.cardTypeId AS FMGJId,A.cardTypeName AS FMGJName,A.service_discount_rate AS FMGJDiscount,
|
|
|
|
|
B.FNo,B.FName,B.FId
|
|
|
|
|
INTO #CardTypeMap
|
|
|
|
|
FROM TMGJCardType AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.cardTypeName LIKE '%' + B.FName + '%'
|
|
|
|
|
OR b.FName LIKE '%' + a.cardTypeName+ '%'
|
|
|
|
|
|
|
|
|
|
insert #CardTypeMap
|
|
|
|
|
SELECT A.cardTypeCode AS FMGJNo,A.cardTypeId AS FMGJId,A.cardTypeName AS FMGJName,A.service_discount_rate AS FMGJDiscount,
|
|
|
|
|
B.FNo,B.FName,B.FId
|
|
|
|
|
FROM TMGJCardType AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.cardTypeName LIKE '%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%'
|
|
|
|
|
AND b.FName LIKE '%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
DELETE #CardTypeMap WHERE FMGJId = 5800
|
|
|
|
|
DELETE #CardTypeMap WHERE FMGJId = 6012
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FName = '<EFBFBD><EFBFBD><EFBFBD>俨10000Ԫ-0.85'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJCourse
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #CardTypeMap
|
|
|
|
|
ORDER BY FMGJNo
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FName = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>29800Ԫ-0.7<EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('004','005','1004') AND FMGJNo = '103'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('006','1009','') AND FMGJNo = '107'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('1007','006','') AND FMGJNo = '201'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('005','','') AND FMGJNo = '108'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('007','1013','') AND FMGJNo = '100'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('007','1013','') AND FMGJNo = '104'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo IN('1010','','') AND FMGJNo = '100'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo NOT IN('1006') AND FMGJNo = '101'
|
|
|
|
|
DELETE #CardTypeMap WHERE FNo NOT IN('2001') AND FMGJNo = '104'
|
|
|
|
|
|
|
|
|
|
UPDATE TMGJCardType SET FCardTypeId = NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM #CardTypeMap AS B,TMGJCardType AS A
|
|
|
|
|
WHERE A.cardTypeId = B.FMGJId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJCardType WHERE FCardTypeId IS NULL
|
|
|
|
|
AND cardTypeId IN(SELECT cardTypeId FROM TMGJCard)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
WHERE FId NOT IN(SELECT ISNULL(FCardTypeId ,0) FROM TMGJCardType)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJCardType ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCardTypeId BIGINT
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJCard SET FCardTypeId = NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FCardTypeId
|
|
|
|
|
FROM TMGJCard AS A,TMGJCardType AS B
|
|
|
|
|
WHERE A.cardTypeId = B.cardTypeId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJCard WHERE FCardTypeId IS NULL
|
|
|
|
|
--AND IsNew = 1
|
|
|
|
|
AND cardNo = '01155'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FCardNo = '66866'
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FId = 3760840163727507456
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJCardType WHERE cardTypeId = 5800
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TMGJItemType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJItemType
|
|
|
|
|
SELECT * FROM TMGJEmployee
|
|
|
|
|
SELECT * FROM TMGJGoodsType
|
|
|
|
|
SELECT * FROM TMGJGoods
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJItem
|
|
|
|
|
/*
|
|
|
|
|
TRUNCATE TABLE TMGJMember
|
|
|
|
|
TRUNCATE TABLE TMGJCard
|
|
|
|
|
TRUNCATE TABLE TMGJMemberCourse
|
|
|
|
|
TRUNCATE TABLE TMGJMemberHist
|
|
|
|
|
TRUNCATE TABLE TMGJMemberHistItem
|
|
|
|
|
*/
|
|
|
|
|
SELECT * FROM TMGJMember
|
|
|
|
|
SELECT * FROM TMGJMemberCourse
|
|
|
|
|
SELECT * FROM TMGJMemberCourseItem
|
|
|
|
|
SELECT * FROM TMGJCard WHERE CardNo = '15036077766'
|
|
|
|
|
SELECT * FROM TMGJMemberHist WHERE memId = 2782703
|
|
|
|
|
SELECT * FROM TMGJMemberHistItem WHERE parentId = '20160309040001'
|
|
|
|
|
|
|
|
|
|
DELETE TMGJMember WHERE
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJCard ADD IsNew BIT NOT NULL DEFAULT 0
|
|
|
|
|
|
|
|
|
|
UPDATE TMGJCard SET IsNew = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJMember ADD IsNew BIT NOT NULL DEFAULT 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJMember ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TMGJMember ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TMGJMember ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE TMGJMember ADD FGender INT
|
|
|
|
|
ALTER TABLE TMGJMember ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE TMGJMember ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TMGJMember ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TMGJMember ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE TMGJMember ADD FBirthdayType CHAR
|
|
|
|
|
ALTER TABLE TMGJMember ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TMGJMember ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TMGJMember ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TMGJMember ADD FArrear DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TMGJMember ADD FPoint DECIMAL(18,6)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TMGJCard ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TMGJCard ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TMGJCard ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TMGJCard ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TMGJCard ADD FCardNo VARCHAR(1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMGJMember
|
|
|
|
|
SET TMGJMember.IsNew = 1
|
|
|
|
|
WHERE id IN(SELECT MemId FROM TMGJCard WHERE IsNew = 1)
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJMember SET FCreateDate = dateadd(s,(cast(createTime as bigint) / 1000),'1970-01-01 00:00:00.000')
|
|
|
|
|
--<EFBFBD><EFBFBD>˾
|
|
|
|
|
UPDATE TMGJMember SET FCompId = 3472333586818924544
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJMember SET FName = name
|
|
|
|
|
--<EFBFBD>绰
|
|
|
|
|
UPDATE TMGJMember SET FMobile = phone
|
|
|
|
|
--<EFBFBD>Ա<EFBFBD>
|
|
|
|
|
UPDATE TMGJMember SET FGender = case when Gender = 'M' THEN 1 ELSE 0 END
|
|
|
|
|
--<EFBFBD><EFBFBD>ע
|
|
|
|
|
UPDATE TMGJMember SET FMemo = comment
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJMember SET FBirthday = dateadd(s,(cast(Birthday as bigint) / 1000),'1970-01-01 00:00:00.000')
|
|
|
|
|
UPDATE TMGJMember SET FBirthdayType = 'G'
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A SET A.FMemNo = (SELECT B.cardNo FROM TMGJCard AS B WHERE B.MemId = A.id) FROM TMGJMember AS A
|
|
|
|
|
UPDATE TMGJMember SET FMemId = id
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>
|
|
|
|
|
select * from TMGJCard
|
|
|
|
|
--<EFBFBD><EFBFBD>ID
|
|
|
|
|
UPDATE TMGJCard SET FCardId = id
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJCard SET FCardNo = CardNo
|
|
|
|
|
--<EFBFBD><EFBFBD>ԱiD
|
|
|
|
|
UPDATE TMGJCard SET FMemId = memId
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJCard SET FBalance = Balance
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMGJCard SET FCreateDate = dateadd(s,(cast(createTime as bigint) / 1000),'1970-01-01 00:00:00.000')
|
|
|
|
|
UPDATE TMGJMember SET FCreateDate = dateadd(s,(cast(createTime as bigint) / 1000),'1970-01-01 00:00:00.000')
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|
|
|
|
SELECT * FROM TMGJMemberHist
|
|
|
|
|
SELECT * FROM TMGJMemberHistItem
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJMemberHistItem ADD FContentText VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TMGJMemberHist ADD FId BIGINT
|
|
|
|
|
ALTER TABLE TMGJMemberHist ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TMGJMemberHist ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TMGJMemberHist ADD FTime DATETIME
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMGJMemberHistItem ADD FAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TMGJMemberHistItem ADD FQuantity DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TMGJMemberHistItem ADD FPrice DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TMGJMemberHist ADD FBillType VARCHAR(30)
|
|
|
|
|
ALTER TABLE TMGJMemberHist ADD FBizType VARCHAR(30)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMGJMemberHist SET FId = dbo.FNNewId()
|
|
|
|
|
UPDATE TMGJMemberHist SET FCompId = 3472333586818924544
|
|
|
|
|
UPDATE TMGJMemberHist SET FMemId = MemId
|
|
|
|
|
UPDATE TMGJMemberHist SET FTime = dateadd(s,(cast(createTime as bigint) / 1000),'1970-01-01 00:00:00.000')
|
|
|
|
|
UPDATE TMGJMemberHist SET FBillType = 'DR_XF' ,FBizType = 'DR_Item' WHERE expenseCategory = 0
|
|
|
|
|
UPDATE TMGJMemberHist SET FBillType = 'DR_XF' ,FBizType = 'DR_Goods' WHERE expenseCategory = 1
|
|
|
|
|
UPDATE TMGJMemberHist SET FBillType = 'DR_KK' ,FBizType = 'DR_CardSale' WHERE expenseCategory = 2
|
|
|
|
|
UPDATE TMGJMemberHist SET FBillType = 'DR_KK' ,FBizType = 'DR_CardRchg' WHERE expenseCategory = 3
|
|
|
|
|
UPDATE TMGJMemberHist SET FBillType = 'DR_KK' ,FBizType = 'DR_CourseSale' WHERE expenseCategory = 4
|
|
|
|
|
UPDATE TMGJMemberHist SET FBillType = 'DR_KK' ,FBizType = 'DR_Other' WHERE expenseCategory = 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMGJMemberHistItem SET FPrice = price
|
|
|
|
|
UPDATE TMGJMemberHistItem SET FAmount = cast(price as float) * cast(itemNum as float)
|
|
|
|
|
UPDATE TMGJMemberHistItem SET FQuantity = itemNum
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FContentText = B.typeName
|
|
|
|
|
FROM TMGJMemberHistItem AS A,TMGJItem AS B
|
|
|
|
|
WHERE B.typeId = A.ItemId
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FContentText = B.productName
|
|
|
|
|
FROM TMGJMemberHistItem AS A,TMGJGoods AS B
|
|
|
|
|
WHERE B.productId = A.ItemId
|
|
|
|
|
AND A.FContentText IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FContentText = B.cardName
|
|
|
|
|
FROM TMGJMemberHistItem AS A,TMGJCourse AS B
|
|
|
|
|
WHERE B.id = A.itemId
|
|
|
|
|
AND A.FContentText IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FContentText = B.cardTypeName
|
|
|
|
|
FROM TMGJMemberHistItem AS A,TMGJCardType AS B
|
|
|
|
|
WHERE B.cardTypeId = A.ItemId
|
|
|
|
|
AND A.FContentText IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJCourse
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJMemberHistItem WHERE displayId = '20160302050001'
|
|
|
|
|
|
|
|
|
|
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'),0,A.FBIllType,A.FBizType,A.displayId AS FTransNo,FCOntentText,FPrice,FQuantity,FAmount,'' as FPayment, '' as Femployee, '' AS FMemo
|
|
|
|
|
FROM TMGJMemberHist AS A,TMGJMemberHistItem AS B
|
|
|
|
|
WHERE A.displayId = B.parentId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJMemberHistItem WHERE FContentText IS Null AND parentId = '20160302050001'
|
|
|
|
|
|
|
|
|
|
SELECT FROM
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMGJItem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember
|
|
|
|
|
|
|
|
|
|
SELECT dateadd(s,1452759303,'1970-01-01 00:00:00.000')
|