|
|
|
|
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 DATETIME
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FIsCourse = 0
|
|
|
|
|
UPDATE hyxx SET FIsCourse = 1
|
|
|
|
|
WHERE klxmc IN('<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','Ⱦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD>̷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','ͷƤ<EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FCalcMode = 0
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FCalcMode = 1
|
|
|
|
|
WHERE klxmc IN('<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD>','','','','ͷƤ<EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>','')
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FCalcMode = 2
|
|
|
|
|
WHERE klxmc IN('','','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','Ⱦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD>̷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
SELECT * FROM hyxx WHERE klxmc IN('<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD>','','','','ͷƤ<EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>','')
|
|
|
|
|
SELECT * FROM hyxx WHERE klxmc IN('','','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','Ⱦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD>̷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FCardTypeId = (SELECT FId FROM ChongQing_FaLaLi.dbo.TMemberCardType WHERE FName = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
WHERE klxmc IN('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','Ⱦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD>̷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
SELECT * FROM hyxx WHERE FCalcMode = 2
|
|
|
|
|
|
|
|
|
|
SELECT * FROM hyxx WHERE hykh = '00008615'
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx SET FRemainTimes = 0 WHERE FCalcMode = 2
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӫ<EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Ⱦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD>̷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ͷƤ<EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCourseId = B.FId,
|
|
|
|
|
A.FItemId = B.FItemId
|
|
|
|
|
FROM hyxx AS A,ChongQing_FaLaLi.dbo.TItem AS I,ChongQing_FaLaLi.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 = B.FId
|
|
|
|
|
FROM hyxx AS A, TMemberCardType AS B
|
|
|
|
|
WHERE A.klxmc = B.FName
|
|
|
|
|
AND A.FCalcMode != 1
|
|
|
|
|
|
|
|
|
|
UPDATE hyxx
|
|
|
|
|
SET FMemId = id,
|
|
|
|
|
FMemNo = hykh,
|
|
|
|
|
FName = hyxm,
|
|
|
|
|
FMobilePhone = replace(dbo.FNToDBC(isnull(yddh,'')) ,' ',''),
|
|
|
|
|
FBriefCode = isnull(xmjm,''),
|
|
|
|
|
FCompId = 1,
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>ID
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FPW = b.mm,
|
|
|
|
|
A.FExpiredDate = ISNULL(B.jzrq,'9999-12-31'),
|
|
|
|
|
A.FCardId = 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
|
|
|
|
|
|
|
|
|
|
UPDATE
|
|
|
|
|
--<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
|
|
|
|
|
|
|
|
|
|
--<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.FCalcMode != 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from ChongQing_FaLaLi.dbo.TMemberCard
|
|
|
|
|
WHERE FState = 4
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TUser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FState = B.FCardState
|
|
|
|
|
FROM ChongQing_FaLaLi.dbo.TMemberCard AS A, hyxx AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND A.FCardId != 11880
|
|
|
|
|
AND B.FCardState = 4
|
|
|
|
|
|
|
|
|
|
select * from hyczk WHERE id = 11880
|
|
|
|
|
|
|
|
|
|
SELECT A.* FROM hyczk AS A,ChongQing_FaLaLi.dbo.TMemberCard AS B
|
|
|
|
|
WHERE A.hykh = B.FCardNo
|
|
|
|
|
AND A.JZRQ = '1900-01-01'
|
|
|
|
|
AND A.JZRQ != B.FExpiredDate
|
|
|
|
|
|
|
|
|
|
SELECT * FROM hyxx WHERE FRemainTimes > 0
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo,FMemo FROM hyxx ORDER BY LEN(FMemo) desc
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
|
|
|
|
|
INSERT INTO ChongQing_FaLaLi.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 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,
|
|
|
|
|
FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from hyxx
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO ChongQing_FaLaLi.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,
|
|
|
|
|
1,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
FMemId AS FMemId,
|
|
|
|
|
1 AS FState,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
|
|
0 AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
0 AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL(qtxx,'') AS FMemo
|
|
|
|
|
FROM hyxx
|
|
|
|
|
WHERE FCalcMode != 1
|
|
|
|
|
AND FMemId NOT IN(SELECT FMemId FROM ChongQing_FaLaLi.dbo.TMember)
|
|
|
|
|
AND FCardTypeId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT ChongQing_FaLaLi.dbo.TMemberCardAccount(FId,FMemId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,NULL,''
|
|
|
|
|
FROM hyxx
|
|
|
|
|
WHERE FCalcMode != 1
|
|
|
|
|
|
|
|
|
|
INSERT ChongQing_FaLaLi.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,'',A.FBalance,0,A.FBalance,0,getdate(),''
|
|
|
|
|
from ChongQing_FaLaLi.dbo.TMemberCardAccount AS A,ChongQing_FaLaLi.dbo.TMemberCard AS C,hyxx AS D
|
|
|
|
|
where C.FCardId = A.FCardId
|
|
|
|
|
AND C.FCardId = D.FCardId
|
|
|
|
|
AND D.FCalcMode != 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT ChongQing_FaLaLi.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 ChongQing_FaLaLi.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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.ChongQing_FaLaLi.dbo.TMember ALTER COLUMN FMoiblePhone VARCHAR(50)
|
|
|
|
|
|
|
|
|
|
INSERT INTO www.ChongQing_FaLaLi.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 dbo.FNNewId(),A.FId,xfrq,A.FId,A.FCompId,'DR','Import','','',cast(dzhje as decimal(18,6)),1,cast(dzhje as decimal(18,6)),'','',''
|
|
|
|
|
FROM xfxx,TMemberCard AS A
|
|
|
|
|
WHERE A.FNo = 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')
|
|
|
|
|
UPDATE TMemberCardAcctHist SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberSaleDetailPayment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FId,FNo INTO #Member FROM TMember WHERE FNo LIKE 'A%'
|
|
|
|
|
AND FCompId = 4734511574699135191
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Member
|
|
|
|
|
|
|
|
|
|
UPDATE #Member SET FNo = REPLACE(REPLACE(REPLACE(REPLACE( REPLACE( REPLACE(Replace(FNo,'<EFBFBD><EFBFBD>',''),'<EFBFBD><EFBFBD>',''),'?',''),';',''),' ',''),'<EFBFBD><EFBFBD>',''),'','')
|
|
|
|
|
|
|
|
|
|
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%'
|