|
|
|
|
use QingDao_HaiDiHui
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TBizLog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TConsumeBill
|
|
|
|
|
|
|
|
|
|
PDeleteConsumeBill 5378409152833492545
|
|
|
|
|
|
|
|
|
|
PClearMemberData
|
|
|
|
|
|
|
|
|
|
SELECT * FROM VIP<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,SUM(<EFBFBD>ϼƽ<EFBFBD><EFBFBD><EFBFBD>) FROM <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼
|
|
|
|
|
GROUP BY VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ALTER COLUMN FMemo VARCHAR(8000)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FIsCourse BIT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FBirhtday DATETIME
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FPW VARCHAR(50)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FGender INT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FBriefCode VARCHAR(50)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FExpiredDate VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FRemainTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCardState INT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FCalcMode INT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FValueType INT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FState INT
|
|
|
|
|
ALTER TABLE VIP<EFBFBD><EFBFBD> ADD FDeleted BIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM VIP<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FCardFeeAmt,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue,FPaySmsFee,FTimeCard,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FCreateTime,FAllowSale,FAllowRchg,FDeptId,FEnabled,FOrder)
|
|
|
|
|
SELECT FId = dbo.FNNewId(),'<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>' +CAST(<EFBFBD>ۿ<EFBFBD> * 10 AS VARCHAR) + '<EFBFBD><EFBFBD>' ,
|
|
|
|
|
'<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>' + CAST(<EFBFBD>ۿ<EFBFBD> * 10 AS VARCHAR)+ '<EFBFBD><EFBFBD>',1,FMaterial = 2,0,FCardFeeAmt = 0,FAcctId = 3,FDeposit = 0,FAcctId2 = 0,FDeposit2 = 0 ,FAcctId3 = 0,FDeposit3 = 0,
|
|
|
|
|
FTimes = 0,FAlertBalance = 0,FMinRchgAmt = 0,FSalePointMode = 0,FSalePointValue = 0 ,FRchgPointMode = 0,FRchgPointValue = 0,FPaySmsFee = 0,FTimeCard = 0,FValidityPeriod = 100,FValidityPeriodUnit = 1,
|
|
|
|
|
FExpiredDate = NULL,FDefaultMemo = '',FCreateTime = GETDATE(),1,1,FDeptId = 0,FEnabled =1,FOrder = 1
|
|
|
|
|
FROM VIP<EFBFBD><EFBFBD>
|
|
|
|
|
WHERE '<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>' +CAST(<EFBFBD>ۿ<EFBFBD> * 10 AS VARCHAR) + '<EFBFBD><EFBFBD>' NOT IN(SELECT FName FROM TMemberCardType )
|
|
|
|
|
GROUP BY <EFBFBD>ۿ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled
|
|
|
|
|
FROM TMemberCardType AS I,TCompany AS C
|
|
|
|
|
WHERE I.FId > 1
|
|
|
|
|
|
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
|
|
|
|
|
|
|
|
|
|
select * from <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼
|
|
|
|
|
ORDER BY ʱ<EFBFBD><EFBFBD> desc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop table <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼
|
|
|
|
|
|
|
|
|
|
where vip<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '885228'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FMemId = dbo.FNNewId()
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FCardId = dbo.FNNewId()
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FMemNO = CAST(VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS BIGINT)
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FName = ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,'')
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD> = '<EFBFBD><EFBFBD>' THEN 1 ELSE 0 END
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FBalance = (SELECT SUM(cast(<EFBFBD>ϼƽ<EFBFBD><EFBFBD><EFBFBD> as float)) FROM <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ WHERE <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼.VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = VIP<EFBFBD><EFBFBD>.VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FMobile = ISNULL(<EFBFBD>ֻ<EFBFBD>,'')
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FMobile = ISNULL(<EFBFBD>绰,'') WHERE FMobile = ''
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FCreateDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FExpiredDate = DATEADD(YEAR,100,FCreateDate)
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FCompiD = 1
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FMemo = ISNULL(<EFBFBD><EFBFBD>ע,'')
|
|
|
|
|
UPDATE VIP<EFBFBD><EFBFBD> SET FState = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId,
|
|
|
|
|
A.FValueType = B.FValueType
|
|
|
|
|
FROM VIP<EFBFBD><EFBFBD> AS A,TMemberCardType AS B
|
|
|
|
|
WHERE '<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD>' + CAST(<EFBFBD>ۿ<EFBFBD> * 10 AS VARCHAR)+ '<EFBFBD><EFBFBD>' = B.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo FROM VIP<EFBFBD><EFBFBD>
|
|
|
|
|
GROUP BY FMemNo Having sum(1) > 1
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FBriefCode = dbo.FNGetFirstPinYin(FName)
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
|
|
|
|
|
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,
|
|
|
|
|
FMemNo,
|
|
|
|
|
FName,
|
|
|
|
|
dbo.FNGetFirstPinYin(FName),
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
FCompId,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FGender,
|
|
|
|
|
'G' AS FBirthdayType,
|
|
|
|
|
FBirthday,
|
|
|
|
|
'' AS FTelephone,
|
|
|
|
|
FMobile ,
|
|
|
|
|
'' AS FQQ,
|
|
|
|
|
'' AS FWeChat,
|
|
|
|
|
'' AS FIdCard,
|
|
|
|
|
'' AS FEmail,
|
|
|
|
|
'' AS FAddress,
|
|
|
|
|
0 AS FProId,
|
|
|
|
|
ISNULL(FPW,'') AS FCPW,
|
|
|
|
|
ISNULL(FPW,'') AS FQPW,
|
|
|
|
|
0 AS FChargeEmpId,
|
|
|
|
|
0 AS FPoint,
|
|
|
|
|
1 AS FRecvConsSMS,
|
|
|
|
|
1 AS FRecvBulkSMS,
|
|
|
|
|
'',
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from VIP<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO dbo.TMemberCard(
|
|
|
|
|
FCardId,
|
|
|
|
|
FCardNo,
|
|
|
|
|
FCardFaceNo,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId,
|
|
|
|
|
FMemId,
|
|
|
|
|
FState,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
FTotalTimes,
|
|
|
|
|
FUsedTimes,
|
|
|
|
|
FSaleCompId,
|
|
|
|
|
FSaleBillId,
|
|
|
|
|
FMemo)
|
|
|
|
|
SELECT
|
|
|
|
|
FCardId AS FId,
|
|
|
|
|
FMemNo AS FNo,
|
|
|
|
|
FMemNo AS FFaceNo,
|
|
|
|
|
FCardTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
FMemId AS FMemId,
|
|
|
|
|
FState AS FState,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
|
|
ISNULL(FRemainTimes,0) AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
0 AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL(FMemo,'') AS FMemo
|
|
|
|
|
FROM VIP<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
delete TMemberCardAccount
|
|
|
|
|
delete TMemberCardAcctHist
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FId,FMemId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FCardId AS FCardId,3,ISNULL(FBalance,0),ISNULL(FBalance,0),0,FCreateDate,NULL,''
|
|
|
|
|
FROM VIP<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT dbo.TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
|
|
|
select dbo.FNNewId(),C.FMemId,A.FCardId,A.FAcctId,getdate(),C.FTypeId,C.FCompId,'DR','Import',0,'',ISNULL(A.FBalance,0),0,ISNULL(A.FBalance,0),0,getdate(),''
|
|
|
|
|
from dbo.TMemberCardAccount AS A,dbo.TMemberCard AS C,VIP<EFBFBD><EFBFBD> AS D
|
|
|
|
|
where C.FCardId = A.FCardId
|
|
|
|
|
AND C.FCardId = D.FCardId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--- end
|
|
|
|
|
|
|
|
|
|
declare @sql varchar(8000)
|
|
|
|
|
select @sql =''
|
|
|
|
|
SELECT @sql = @sql + ' exec sp_rename ''' + a.name + '.[' + b.name + ']'',' + replace(b.name,'"','')
|
|
|
|
|
from sysobjects as a,syscolumns as b
|
|
|
|
|
where a.id = b.id
|
|
|
|
|
and a.name = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ'
|
|
|
|
|
exec (@sql)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ADD FId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FCompId,
|
|
|
|
|
A.FMemId = B.FMemId,
|
|
|
|
|
A.FCardId = B.FCardId,
|
|
|
|
|
A.FId= dbo.FNnewId()
|
|
|
|
|
FROM VIP<EFBFBD><EFBFBD> AS B,<EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS A
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.vip<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT A.FId,A.FMemId,ʱ<EFBFBD><EFBFBD>,A.FCardId,A.FCompId,'DR','Import','',b.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,cast(b.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> as float),1,cast(b.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> as float),ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ,'') + ',' + ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'') ,'',ISNULL(<EFBFBD><EFBFBD>ע,'')
|
|
|
|
|
FROM <EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS A,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ as b
|
|
|
|
|
WHERE a.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Id = b.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>id
|
|
|
|
|
and a.FMemId is not null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ ADD FId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FCompId,
|
|
|
|
|
A.FMemId = B.FMemId,
|
|
|
|
|
A.FCardId = B.FCardId,
|
|
|
|
|
A.FId= dbo.FNnewId()
|
|
|
|
|
FROM VIP<EFBFBD><EFBFBD> AS B,<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ AS A
|
|
|
|
|
WHERE A.vip<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.vip<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT FId,A.FMemId,ʱ<EFBFBD><EFBFBD>,A.FCardId,A.FCompId,'DR','Import','',<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> as decimal(18,6)),1,cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> as decimal(18,6)),ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ,'') + ',' + ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'') ,'',ISNULL(<EFBFBD><EFBFBD>ע,'')
|
|
|
|
|
FROM <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ AS A
|
|
|
|
|
|
|
|
|
|
SELECT * FROM VIP<EFBFBD><EFBFBD> WHERE VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '885023'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ WHERE VIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '885228'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>¼ ORDER BY ʱ<EFBFBD><EFBFBD> desc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|