|
|
ALTER TABLE hyxx ADD FCourseId BIGINT
|
|
|
ALTER TABLE hyxx ADD FItemId BIGINT
|
|
|
ALTER TABLE hyxx ADD FMemId BIGINT
|
|
|
ALTER TABLE hyxx ADD FMemNo VARCHAR(50)
|
|
|
ALTER TABLE hyxx ADD FCardTypeId BIGINT
|
|
|
ALTER TABLE hyxx ADD FName VARCHAR(50)
|
|
|
ALTER TABLE hyxx ADD FMobilePhone VARCHAR(50)
|
|
|
ALTER TABLE hyxx ADD FMemo VARCHAR(1000)
|
|
|
ALTER TABLE hyxx ALTER COLUMN FMemo VARCHAR(8000)
|
|
|
ALTER TABLE hyxx ADD FBirthday DATETIME
|
|
|
ALTER TABLE hyxx ADD FCreateDate DATETIME
|
|
|
ALTER TABLE hyxx ADD FIsCourse BIT
|
|
|
ALTER TABLE hyxx ADD FCompId BIGINT
|
|
|
ALTER TABLE hyxx ADD FBirhtday DATETIME
|
|
|
ALTER TABLE hyxx ADD FPW VARCHAR(50)
|
|
|
ALTER TABLE hyxx ADD FGender INT
|
|
|
ALTER TABLE hyxx ADD FBriefCode VARCHAR(50)
|
|
|
ALTER TABLE hyxx ADD FExpiredDate VARCHAR(100)
|
|
|
|
|
|
ALTER TABLE hyxx ADD FBalance DECIMAL(18,6)
|
|
|
ALTER TABLE hyxx ADD FRemainTimes DECIMAL(18,6)
|
|
|
ALTER TABLE hyxx ADD FCardId BIGINT
|
|
|
ALTER TABLE hyxx ADD FCardState INT
|
|
|
ALTER TABLE hyxx ADD FCalcMode INT
|
|
|
ALTER TABLE hyxx ADD FValueType INT
|
|
|
|
|
|
DELETE hyxx WITH(ROWLOCK) WHERE hykh = '0000'
|
|
|
|
|
|
|
|
|
|
|
|
EXEC SP_RENAME 'hyxx','hyxx1a'
|
|
|
EXEC SP_RENAME 'hyczk','hyczk1a'
|
|
|
EXEC SP_RENAME 'xfxx','xfxx1a'
|
|
|
|
|
|
EXEC SP_RENAME 'hyxx','hyxx1b'
|
|
|
EXEC SP_RENAME 'hyczk','hyczk1b'
|
|
|
EXEC SP_RENAME 'xfxx','xfxx1b'
|
|
|
|
|
|
EXEC SP_RENAME 'hyxx','hyxx2'
|
|
|
EXEC SP_RENAME 'hyczk','hyczk2'
|
|
|
EXEC SP_RENAME 'xfxx','xfxx2'
|
|
|
|
|
|
EXEC SP_RENAME 'czk','czk1a'
|
|
|
EXEC SP_RENAME 'zkk','zkk1a'
|
|
|
|
|
|
EXEC SP_RENAME 'czk','czk1b'
|
|
|
EXEC SP_RENAME 'zkk','zkk1b'
|
|
|
|
|
|
EXEC SP_RENAME 'czk','czk2'
|
|
|
EXEC SP_RENAME 'zkk','zkk2'
|
|
|
|
|
|
|
|
|
SELECT * FROM zkk
|
|
|
SELECT * FROM czk
|
|
|
|
|
|
|
|
|
SELECT * FROM hyxx
|
|
|
SELECT * FROM hyczk
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FCardNO = '501861'
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FId = 5702334613264406354
|
|
|
|
|
|
SELECT * FROM hyxx WHERE hykh = '501861'
|
|
|
SELECT * FROM hyczk WHERE hykh = '501861'
|
|
|
|
|
|
|
|
|
SELECT * FROM czk11 WHERE id = '01'
|
|
|
|
|
|
SELECT * FROM yhk
|
|
|
|
|
|
SELECT * FROM TMemberSaleBill
|
|
|
|
|
|
select count(1) from xfxx WITH(NOLOCK)
|
|
|
|
|
|
|
|
|
USE JINAN_ZICAIJIN
|
|
|
|
|
|
SELECT * FROM czk11
|
|
|
SELECT * FROM czk12
|
|
|
|
|
|
drop table hyxx
|
|
|
drop table hyczk
|
|
|
drop table xfxx
|
|
|
|
|
|
SELECT * FROM hyxx
|
|
|
WITH(NOLOCK)
|
|
|
|
|
|
SELECT * FROM hyxx12
|
|
|
WITH(NOLOCK)
|
|
|
|
|
|
|
|
|
WHERE hykh IN(
|
|
|
SELECT hykh FROM hyxx with(nolock)
|
|
|
)
|
|
|
|
|
|
WITH(NOLOCK) WHERE hykh IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
|
select count(1) from hyxx with(nolock)
|
|
|
select count(1) from hyczk with(nolock)
|
|
|
|
|
|
|
|
|
drop table hyxx
|
|
|
drop table hyczk
|
|
|
drop table xfxx
|
|
|
|
|
|
SELECT * FROM czk12
|
|
|
|
|
|
SELECT * FROM zkk
|
|
|
SELECT * FROM czk
|
|
|
|
|
|
SELECT * FROM hyxx
|
|
|
|
|
|
DELETE TMemberCardType WHERE FDeleted = 1
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FId = 6317844158556799277
|
|
|
|
|
|
SELECT * FROM TMemberCard
|
|
|
WHERE FTypeId IN(SELECT FId FROM TMemberCardType WHERE FDeleted = 1)
|
|
|
|
|
|
UPDATE TMemberCardType SET FNo = '<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>' + FNo,FDeleted = 1
|
|
|
WHERE FNo like 'mp%'
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET kmc = replace(klx,' ','')
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ALTER TABLE hyxx ALTER COLUMN klx INT
|
|
|
|
|
|
|
|
|
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(), kmc as fno,kmc,CASE WHEN klx = 2 THEN 3 ELSE 1 END,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 hyxx
|
|
|
GROUP BY kmc,klx
|
|
|
ORDER BY kmc
|
|
|
|
|
|
SELECT * FROM
|
|
|
|
|
|
|
|
|
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 hyxx WHERE klx = 1 AND kmc = '5<EFBFBD><EFBFBD>'
|
|
|
SELECT * FROM hyxx WHERE klx = 2 AND kmc = '5<EFBFBD><EFBFBD>'
|
|
|
|
|
|
SELECT * FROM hyxx WHERE klx = 0 AND kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
SELECT * FROM hyxx WHERE klx = 1 AND kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
SELECT * FROM hyxx WHERE klx = 2 AND kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
SELECT * FROM hyczk WHERE hykh = '10002321'
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
UPDATE hyxx SET kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨500[<EFBFBD><EFBFBD>ֵ]' WHERE kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨500' AND klx = 1
|
|
|
UPDATE hyxx SET kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨500[<EFBFBD>ƴ<EFBFBD>]' WHERE kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨500' AND klx = 2
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '<EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
|
|
|
|
|
|
--1b
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>Ա'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD>ۿ<EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
|
|
|
--END
|
|
|
|
|
|
|
|
|
--2
|
|
|
UPDATE hyxx SET kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<EFBFBD><EFBFBD>ֵ]' WHERE kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AND klx = 1
|
|
|
UPDATE hyxx SET kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<EFBFBD>ƴ<EFBFBD>]' WHERE kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AND klx = 2
|
|
|
UPDATE hyxx SET kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<EFBFBD><EFBFBD>ֵ]' klx = 1 WHERE kmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<EFBFBD><EFBFBD>ֵ]' AND klx = 0
|
|
|
|
|
|
UPDATE hyxx SET klx = 1 WHERE hykh IN( '77001307','88001131')
|
|
|
|
|
|
UPDATE hyxx SET klx = 1 WHERE hykh IN( '88000927')
|
|
|
UPDATE hyxx SET kmc = 'VIP<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>' WHERE hykh IN( '88001320','09','05')
|
|
|
UPDATE hyxx SET kmc = 'VIP<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>',klx=1 WHERE hykh IN( '07')
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = 'vip<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
AND A.hykh = '88001317'
|
|
|
|
|
|
|
|
|
--end
|
|
|
|
|
|
--3
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.kmc = C.kmc
|
|
|
FROM hyxx AS A,czk AS C,hyczk AS B
|
|
|
WHERE A.hykh = B.hykh
|
|
|
AND A.kmc = '5<EFBFBD><EFBFBD>'
|
|
|
AND A.klx = 2
|
|
|
AND B.kid = C.id
|
|
|
AND A.hykh = '1000065'
|
|
|
--end
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET klx = 2 WHERE kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨200Ԫ' AND klx = 1
|
|
|
UPDATE hyxx SET klx = 2 WHERE kmc = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨300' AND klx = 1
|
|
|
UPDATE hyxx SET klx = 1 WHERE kmc = '<EFBFBD><EFBFBD><EFBFBD>㿨' AND klx = 2
|
|
|
|
|
|
|
|
|
|
|
|
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 C.FId = dbo.FNCompId('001')
|
|
|
AND I.FNo LIKE 'MP1B%'
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM hyczk WHERE kzt != '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
AND hykh IN(SELECT hykh FROM hyxx WHERE FCardTypeId != 0)
|
|
|
|
|
|
SELECT * FROM hyczk where jzrq is null
|
|
|
|
|
|
SELECT kmc FROM hyxx
|
|
|
GROUP BY kmc
|
|
|
|
|
|
|
|
|
SELECT * FROM hyxx WHERE FCalcMode = 2
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FRemainTimes = 0 WHERE FCalcMode = 2
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
UPDATE A
|
|
|
SET A.FCourseId = B.FId,
|
|
|
A.FItemId = B.FItemId
|
|
|
FROM hyxx AS A,ZhaoYuan_JingDian.dbo.TItem AS I,ZhaoYuan_JingDian.dbo.TCourse AS B
|
|
|
WHERE A.klxmc = I.FName
|
|
|
AND B.FItemId = I.FId
|
|
|
AND A.FIsCourse = 1
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FCardTypeId = C.FId,
|
|
|
A.FValueType = C.FValueType
|
|
|
FROM hyxx AS A,TMemberCardType AS C
|
|
|
WHERE A.kmc = c.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FMemId = 400000 + id,
|
|
|
FMemNo = hykh,
|
|
|
FName = replace(hyxm,' ',''),
|
|
|
FMobilePhone = replace(dbo.FNToDBC(isnull(yddh,'')) ,' ',''),
|
|
|
FBriefCode = isnull(xmjm,''),
|
|
|
FCompId = dbo.FNCompId('001'),
|
|
|
FCreateDate = jrrq,
|
|
|
FGender = case a.xb when '<EFBFBD><EFBFBD>' then 1 else 0 end ,
|
|
|
FBirthday = a.csrq,
|
|
|
FMemo = isnull(a.lxdz,'') + char(10) + isnull(a.qtxx,'')
|
|
|
FROM hyxx as a
|
|
|
|
|
|
UPDATE hyxx SET FMemNo = REPLACE(REPLACE(REPLACE(REPLACE( REPLACE( REPLACE(Replace(FMemNo,'<EFBFBD><EFBFBD>',''),'<EFBFBD><EFBFBD>',''),'?',''),';',''),' ',''),'<EFBFBD><EFBFBD>',''),'','')
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ע
|
|
|
UPDATE a
|
|
|
SET A.FMemo = isnull(cast(a.bzxx as varchar(1000)),'') + ' ' + isnull(cast(a.qtxx as varchar(1000)),'') + isnull(cast(B.bz as varchar(1000)),'')
|
|
|
FROM hyxx AS A
|
|
|
left join hyczk AS B ON b.hykh = a.hykh
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>ID,<EFBFBD><EFBFBD>״̬
|
|
|
UPDATE A
|
|
|
SET A.FPW = b.mm,
|
|
|
A.FCardId = 400000 + B.id ,
|
|
|
A.FCardState = case when b.kzt = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN 4 ELSE 1 END
|
|
|
FROM hyxx AS A,hyczk AS B
|
|
|
WHERE A.hykh = b.hykh
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>ID
|
|
|
|
|
|
|
|
|
SELECT FExpiredDate FROM hyxx
|
|
|
WHERE len(FExpiredDate) != 0
|
|
|
ORDER BY FExpiredDate DESC
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FExpiredDate = ''
|
|
|
FROM hyxx AS A
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FExpiredDate = REPLACE(ISNULL(a.dzyj,'9000-12-31'),' ','')
|
|
|
FROM hyxx AS A
|
|
|
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = replace(FExpiredDate,'.','-')
|
|
|
WHERE LEN(FExpiredDate) > 0
|
|
|
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = replace(FExpiredDate,'/','-')
|
|
|
WHERE LEN(FExpiredDate) > 0
|
|
|
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = left(FExpiredDate,4) + '-' + substring(FExpiredDate,5,2) + '-' + right(FExpiredDate,2)
|
|
|
WHERE LEN(dzyj) = 8
|
|
|
AND FExpiredDate NOT LIKE '%.%'
|
|
|
AND FExpiredDate NOT LIKE '%-%'
|
|
|
AND FExpiredDate NOT LIKE '%/%'
|
|
|
AND LEN(FExpiredDate) > 0
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = '2017-03-29 '
|
|
|
WHERE FExpiredDate = '2017-34-29'
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = '2017-12-31'
|
|
|
WHERE FExpiredDate = '201712-31'
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = '2017-12-31'
|
|
|
WHERE FExpiredDate = '2017-1231'
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET FExpiredDate = '2017-03-29'
|
|
|
WHERE FExpiredDate = '201703-29'
|
|
|
|
|
|
UPDATE hyxx SET FExpiredDate = '9000-01-01' WHERE LEN(FExpiredDate) = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ̵Ĵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FRemainTimes = b.dqje
|
|
|
FROM hyxx AS A,hyczk AS B
|
|
|
WHERE A.hykh = b.hykh
|
|
|
AND A.FCalcMode = 1
|
|
|
|
|
|
SELECT * FROM hyczk WHERE kid IN(SELECT FNo FROM TMemberCardType WHERE FValueType = 3)
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
UPDATE A
|
|
|
SET A.FBalance = b.dqje
|
|
|
FROM hyxx AS A,hyczk AS B
|
|
|
WHERE A.hykh = b.hykh
|
|
|
AND A.FValueType = 1
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FRemainTimes = b.dqje
|
|
|
FROM hyxx AS A,hyczk AS B
|
|
|
WHERE A.hykh = b.hykh
|
|
|
AND A.FValueType = 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FMemo = REPLACE(FMemo,'--','')
|
|
|
|
|
|
|
|
|
SELECT FMemNo,FMemo FROM hyxx ORDER BY LEN(FMemo) desc
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FMemNO = 'C' + FMemNo + ''
|
|
|
WHERE hykh IN(SELECT FMemNO FROM TMember)
|
|
|
|
|
|
|
|
|
--<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,
|
|
|
FBriefCode,
|
|
|
0 AS FTypeId,
|
|
|
FCompId,
|
|
|
FCreateDate,
|
|
|
FGender,
|
|
|
'G' AS FBirthdayType,
|
|
|
FBirthday,
|
|
|
'' AS FTelephone,
|
|
|
FMobilePhone,
|
|
|
'' 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 hyxx
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
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,
|
|
|
FCardState AS FState,
|
|
|
FCreateDate AS FCreateDate,
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
ISNULL(FRemainTimes,0) AS FTotalTimes,
|
|
|
0 AS FUsedTimes,
|
|
|
0 AS FSaleCompId,
|
|
|
0 AS FSaleBillId,
|
|
|
FMemo AS FMemo
|
|
|
FROM hyxx
|
|
|
WHERE FCardId IS NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
UPDATE TMember SET FCompId = 5483664731777789989
|
|
|
UPDATE TMemberCard SET FCompId = 5483664731777789989
|
|
|
UPDATE TMemberOldTransHist SET FCompId = 5483664731777789989
|
|
|
UPDATE TMemberCardAcctHist SET FCompId = 5483664731777789989
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = '9000-1-1' WHERE FExpiredDate <= '1900-01-02'
|
|
|
|
|
|
UPDATE TMemberCardAccount SET FExpiredDate = null
|
|
|
|
|
|
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 hyxx
|
|
|
WHERE FCardId IS NOT NULL
|
|
|
|
|
|
WHERE FCalcMode != 1
|
|
|
|
|
|
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,hyxx AS D
|
|
|
where C.FCardId = A.FCardId
|
|
|
AND C.FCardId = D.FCardId
|
|
|
|
|
|
AND D.FCalcMode != 1
|
|
|
|
|
|
|
|
|
INSERT ZhaoYuan_JingDian.dbo.TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
SELECT FCardId,FMemId,FCourseId,0,FItemId,FCompId,FRemainTimes,FRemainTimes,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'',FCalcMode,0
|
|
|
FROM hyxx
|
|
|
WHERE FIsCourse = 1
|
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
|
INSERT INTO ZhaoYuan_JingDian.dbo.TMemberCourseHist(FId,FMemId,FMemCourseId,FPackId,FCourseId,FTime,FPurTimes,FFreeTimes,FUsePurTimes,FUseFreeTimes,
|
|
|
FPurAmount,FFreeAmount,FUsePurAmount,FUseFreeAmount,FCompId,
|
|
|
FBillType,FBizType,FTransId,FTransNo,FTransDetailId)
|
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FCardId,0,FCourseId,FTime = getdate(),0,0,0,0,
|
|
|
0,0,0,0,1,
|
|
|
'DR','Import',0,'',0
|
|
|
|
|
|
FROM hyxx
|
|
|
WHERE FIsCourse = 1
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|
|
TRUNCATE TABLE TMemberOldTransHist
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
SELECT b.id,A.FMemId,xfrq,A.FCardId,A.FCompId,'DR','Import','',bz,cast(dzhje as decimal(18,6)),1,cast(dzhje as decimal(18,6)),'','',''
|
|
|
FROM xfxx AS B,TMemberCard AS A ,hyxx AS C
|
|
|
WHERE replace(C.hykh,'C','') = B.hykh
|
|
|
AND C.FCardId = A.FCardId
|
|
|
|
|
|
|
|
|
SELECT * FROM xfxx1a
|
|
|
|
|
|
|
|
|
SELECT klxmc FROM hyxx group by klxmc ORDER BY klxmc
|
|
|
|
|
|
ALTER TABLE hyxx ADD FCourseId
|
|
|
|
|
|
|
|
|
select * from hyxx WHERE klxmc = 'ͷƤ<EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>'
|
|
|
|
|
|
SELECT * INTO hyxx FROM master..hyxx
|
|
|
SELECT * INTO xfxx FROM master..xfxx
|
|
|
|
|
|
SELECT * FROM hyxx WHERE klxmc = '<EFBFBD><EFBFBD>ͨ<EFBFBD>˿<EFBFBD>'
|
|
|
SELECT * FROM hyxx WHERE bzxx is not null
|
|
|
|
|
|
SELECT * FROM hyxx WHERE hykh = '702058'
|
|
|
|
|
|
SELECT * FROM hyczk WHERE hykh = '702058'
|
|
|
|
|
|
SELECT * FROM hyczk WHERE kzt != '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
SELECT klxmc FROM hyxx GROUP BY klxmc
|
|
|
|
|
|
SELECT qtxx,lxdz FROM hyxx GROUP BY qtxx
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
|
SELECT yddh ,sum(1)
|
|
|
from hyxx GROUP BY yddh
|
|
|
|
|
|
SELECT * FROM TCompany WHERE FId = 4734511574699135191
|
|
|
|
|
|
update hyxx SET id = '2000' + cast(id as varchar(20))
|
|
|
SELECT * FROM hyxx
|
|
|
|
|
|
UPDATE hyxx
|
|
|
SET hykh = 'A' + hykh
|
|
|
|
|
|
SET hykh = REPLACE(REPLACE(REPLACE(REPLACE( REPLACE( REPLACE(Replace(hykh,'<EFBFBD><EFBFBD>',''),'<EFBFBD><EFBFBD>',''),'?',''),';',''),' ',''),'<EFBFBD><EFBFBD>',''),'A','')
|
|
|
|
|
|
drop table hyxx
|
|
|
|
|
|
|
|
|
SELECT a.id AS FId,
|
|
|
a.hykh AS FNo,
|
|
|
a.hyxm AS FName,
|
|
|
isnull(a.xmjm,'') AS FBriefCode,
|
|
|
0 AS FTypeId,
|
|
|
1 AS FCompId,
|
|
|
a.jrrq AS FCreateDate,
|
|
|
case a.xb when '<EFBFBD><EFBFBD>' then 1 else 0 end AS FGender,
|
|
|
'G' AS FBirthdayType,
|
|
|
a.csrq AS FBirthday,
|
|
|
'' AS FTelephone,
|
|
|
isnull( replace(dbo.todbc(a.yddh) ,' ',''),'') as FMobilePhone,
|
|
|
'' AS FQQ,
|
|
|
'' AS FWeChat,
|
|
|
'' AS FIdCard,
|
|
|
'' AS FEmail,
|
|
|
'' AS FAddress,
|
|
|
0 AS FProId,
|
|
|
'' AS FCPW,
|
|
|
'' AS FQPW,
|
|
|
0 AS FChargeEmpId,
|
|
|
0 AS FPoint,
|
|
|
1 AS FRecvConsSMS,
|
|
|
1 AS FRecvBulkSMS,
|
|
|
isnull(a.lxdz,'') + char(10) + isnull(a.qtxx,'') + char(10) AS FMemo,
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
from hyxx as a
|
|
|
|
|
|
|
|
|
|
|
|
SELECT hykh,sum(1)
|
|
|
FROM hyxx
|
|
|
group by hykh
|
|
|
order by sum(1) desc
|
|
|
|
|
|
SELECT * FROM hyxx WHERE hykh = '801218'
|
|
|
|
|
|
UPDATE TMemberOldTransHist SET FCompId = 1
|
|
|
|
|
|
SELECT yddh from hyxx order by len(yddh) desc
|
|
|
|
|
|
ALTER TABLE
|
|
|
|
|
|
ALTER TABLE www.ZhaoYuan_JingDian.dbo.TMember ALTER COLUMN FMoiblePhone VARCHAR(50)
|
|
|
|
|
|
INSERT INTO www.ZhaoYuan_JingDian.dbo.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 id AS FId,
|
|
|
hykh AS FNo,
|
|
|
hyxm AS FName,
|
|
|
isnull(xmjm,'') AS FBriefCode,
|
|
|
0 AS FTypeId,
|
|
|
1 AS FCompId,
|
|
|
jrrq AS FCreateDate,
|
|
|
case xb when '<EFBFBD><EFBFBD>' then 1 else 0 end AS FGender,
|
|
|
'G' AS FBirthdayType,
|
|
|
csrq AS FBirthday,
|
|
|
'' AS FTelephone,
|
|
|
isnull( replace(dbo.todbc(yddh) ,' ',''),'') as FMobilePhone,
|
|
|
'' AS FQQ,
|
|
|
'' AS FWeChat,
|
|
|
'' AS FIdCard,
|
|
|
'' AS FEmail,
|
|
|
'' AS FAddress,
|
|
|
0 AS FProId,
|
|
|
'' AS FCPW,
|
|
|
'' AS FQPW,
|
|
|
0 AS FChargeEmpId,
|
|
|
0 AS FPoint,
|
|
|
1 AS FRecvConsSMS,
|
|
|
1 AS FRecvBulkSMS,
|
|
|
isnull(lxdz,'') AS FMemo,
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
from hyxx
|
|
|
|
|
|
|
|
|
SELECT klxmc FROM hyxx group by klxmc ORDER BY klxmc
|
|
|
|
|
|
ALTER TABLE hyxx ADD FCourseId
|
|
|
|
|
|
|
|
|
select * from hyxx WHERE klxmc = '<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
alter table hyxx ADD Times int default 0 not null
|
|
|
|
|
|
UPDATE hyxx SET Times = knje,knje = knje * 10 where klxmc = '<EFBFBD>ƴο<EFBFBD>'
|
|
|
|
|
|
SEL
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
|
FCardId,
|
|
|
FCardNo,
|
|
|
FFaceNo,
|
|
|
FTypeId,
|
|
|
FValueType,
|
|
|
FCompId,
|
|
|
FMemId,
|
|
|
FState,
|
|
|
FCreateDate,
|
|
|
FExpiredDate,
|
|
|
FTotalTimes,
|
|
|
FUsedTimes,
|
|
|
FSaleCompId,
|
|
|
FSaleBillId,
|
|
|
FMemo)
|
|
|
SELECT
|
|
|
id AS FId,
|
|
|
hykh AS FNo,
|
|
|
hykh AS FFaceNo,
|
|
|
(SELECT FId FROM TMemberCardType WHERE FName = klxmc) AS FTypeId,
|
|
|
(SELECT FValueType FROM TMemberCardType WHERE FName = klxmc) AS FValueType,
|
|
|
1 AS FCompId,
|
|
|
id AS FMemId,
|
|
|
1 AS FState,
|
|
|
jrrq AS FCreateDate,
|
|
|
dateadd(yy,100,jrrq) AS FExpiredDate,
|
|
|
Times AS FTotalTimes,
|
|
|
0 AS FUsedTimes,
|
|
|
0 AS FSaleCompId,
|
|
|
0 AS FSaleBillId,
|
|
|
ISNULL(qtxx,'') AS FMemo
|
|
|
FROM hyxx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
SELECT dbo.FNNewId(),id AS FCardId,3,FBalance,FBalance,0,jrrq,NULL,''
|
|
|
FROM hyxx
|
|
|
|
|
|
INSERT 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,'',A.FBalance,0,A.FBalance,0,getdate(),''
|
|
|
from TMemberCardAccount AS A,TMemberCard AS C,hyxx AS D
|
|
|
where C.FId = A.FCardId
|
|
|
AND C.FId = D.id
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
SELECT id,A.FMemId,xfrq,A.FCardId,A.FCompId,'DR','Import','','',cast(dzhje as decimal(18,6)),1,cast(dzhje as decimal(18,6)),'','',bz
|
|
|
FROM xfxx1a,TMemberCard AS A
|
|
|
WHERE A.FCardNo = hykh
|
|
|
|
|
|
select * from xfxx2
|
|
|
update xfxx2 set hykh = 'A' + hykh
|
|
|
|
|
|
Truncate table TMemberOldTransHist
|
|
|
|
|
|
select * from xfxx
|
|
|
|
|
|
SELECT * FROM TMemberOld
|
|
|
|
|
|
select dateadd(yy,100,getdate())
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = dateadd(yy,100,FCreateDate)
|
|
|
|
|
|
insert gcm12
|
|
|
(gcn00c,gcn01c,gcn02c,gcn09f,gcn10i,gcn12d,gcn13d,gcn15c,gcn17c,gcn22i,gcn24i,gcn04c,gcn06i,gcn03c,gcn16f)
|
|
|
select
|
|
|
'003',hykh,'0',knje,'0',jrrq,'22000101',hykh,'003','1','1',yddh,xb,hyxm,hyjf
|
|
|
from gcm12_01
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
UPDATE TMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
DELETE TMember WHERE FMemId > 0
|
|
|
|
|
|
UPDATE TMemberCardAcctHist SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberSaleDetailPayment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE #Member SET FNo = REPLACE(FNo,'A','') WHERE FNo LIKE 'A%'
|
|
|
|
|
|
UPDATE #Member SET FNo = 'A' + FNo
|
|
|
WHERE FNo IN (SELECT FNo FROM TMember WHERE FCompId != 4734511574699135191)
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Member WHERE FNo like 'A%'
|
|
|
|
|
|
UPDATE B
|
|
|
SET B.FNo = 'A' + B.FNo
|
|
|
FROM #Member AS B,
|
|
|
(
|
|
|
SELECT FNo, COUNT(1) as cnt,max(FId) as FId FROM #Member
|
|
|
GROUP BY FNo
|
|
|
) AS A
|
|
|
WHERE cnt > 1
|
|
|
AND B.FId = A.FId
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FNo = B.FNo
|
|
|
FROM TMember AS A,#Member AS B
|
|
|
WHERE A.FId = B.FId
|
|
|
|
|
|
SELECT * FROM TMember WHERE FNo like 'A%'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FNo = B.FNo,
|
|
|
A.FFaceNo = B.FNo
|
|
|
FROM TMemberCard AS A,TMember AS B
|
|
|
WHERE A.FId = B.FId
|
|
|
AND B.FCompId = 4734511574699135191
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FNo like '%801127%' |