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.
 
 
 
 
 
sql-tools/Import/飞跃.sql

614 lines
19 KiB

use JiNan_AIShangPin_MeiLianDian_FEIYUE
SELECT count(1) FROM mem_info WITH(NOLOCK)
WHERE CardCode NOT IN(SELECT CardCode FROM mem_fund)
--»áÔ±
ALTER TABLE mem_info ADD FMemId BIGINT NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FMemNo VARCHAR(50) NOT NULL DEFAULT ''
ALTER TABLE mem_info ADD FName VARCHAR(50) NOT NULL DEFAULT ''
ALTER TABLE mem_info ADD FGender INT NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FMobile VARCHAR(50) NOT NULL DEFAULT ''
ALTER TABLE mem_info ADD FMemo VARCHAR(1000) DEFAULT ''
ALTER TABLE mem_info ADD FArrear DECIMAL(18,6) DEFAULT 0
ALTER TABLE mem_info ADD FPoint DECIMAL(18,6) DEFAULT 0
ALTER TABLE mem_info ADD FBirthday DATETIME
ALTER TABLE mem_info ADD FBirthdayType CHAR NOT NULL DEFAULT ''
ALTER TABLE mem_info ADD FCreateDate DATETIME
ALTER TABLE mem_info ADD FExpiredDate DATETIME
ALTER TABLE mem_info ADD FCompId BIGINT DEFAULT 0
ALTER TABLE mem_info ADD FDeleted BIT NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FPassword VARCHAR(1000) DEFAULT ''
ALTER TABLE mem_info ADD FCardNo VARCHAR(50) NOT NULL DEFAULT ''
ALTER TABLE mem_info ADD FCardTypeId BIGINT NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FBalance DECIMAL(18,6) NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FRemainTimes INT NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FCardId BIGINT NOT NULL DEFAULT 0
ALTER TABLE mem_info ADD FCardMemo VARCHAR(1000) NOT NULL DEFAULT ''
ALTER TABLE mem_info ADD FCardState INT NOT NULL DEFAULT 0
SELECT * FROM card_level
SELECT * FROM JiNan_AIShangPin_MeiLianDian..TCompany
UPDATE mem_info SET FCardTypeId = abs( CAST( CAST(CAST(CardTypeGUID AS UNIQUEIDENTIFIER) AS BINARY(16)) AS BIGINT))
---¿¨Àà±ð
INSERT JiNan_AIShangPin_MeiLianDian..TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FAllowSale,FAllowRchg,FEnabled,FOrder,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue)
SELECT FId = 20000+level_id,
FNo = '' + cast(level_id as varchar),
FName = level_name,
1 AS FValueType,
2 AS FMaterial,
0 AS FPrice,
3 AS FAcctId,
0 AS FDeposit,
0 as FAcctId2,
0 AS FDeposit2,
0 AS FAcctId3,
0 AS FDeposit3,
0 AS FTimes,
0 AS FAlertBalance,
0 AS FMinRchgAmt,
0 AS FValidityPeriod,
0 AS FValidityPeriodUnit,
1 AS FAllowSale,
1 AS FAllowRchg,
1,
1,
0 AS FSalePointMode,
0 AS FSalePointValue,
0 AS FRchgPointMode,
0 AS FRchgPointValue
FROM card_level
SELECT * FROM JiNan_AIShangPin_MeiLianDian..TCompany
SELECT * FROM JiNan_AIShangPin_MeiLianDian..TMemberCardTypeCross
SELECT * FROM JiNan_AIShangPin_MeiLianDian..TMemberCardTypeCross
INSERT INTO JiNan_AIShangPin_MeiLianDian..TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
SELECT JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled
FROM JiNan_AIShangPin_MeiLianDian..TMemberCardType AS I,JiNan_AIShangPin_MeiLianDian..TCompany AS C
WHERE I.FId > 1
AND C.FId != 0
AND C.FNo IN('001')
AND NOT EXISTS(SELECT TOP 1 1 FROM JiNan_AIShangPin_MeiLianDian..TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
UPDATE JiNan_AIShangPin_MeiLianDian..TMemberCardTypeSub SET FCompID = DBO.FNCompId('007')
WHERE FCompId = dbo.FNCompId('006')
AND FCardTypeID IN(SELECT FId FROM TMemberCardType WHERE FNo like 'TL%')
PCheckMemberCardAllowCross
use jinan_fuhang
SELECT * FROM mem_info
UPDATE A
SET A.FCardTypeId = 20000 + level_id
FROM mem_info AS A
UPDATE A
SET A.FCardTypeId = B.FCardTypeId
FROM JiNan_AIShangPin_MeiLianDian..TMemberCardAcctHist AS A,mem_info AS B
WHERE A.FCardId = B.FCardId
UPDATE JiNan_AIShangPin_MeiLianDian..TMemberCardType SET FAllowSale = 1,FAllowRchg = 1
SELECT * FROM TMemberCardType
--»áÔ±×ÊÁÏ
SELECT * FROM mem_info WHERE GuestName IS NULL
select card_id from mem_info
group by card_id
having(sum(1) > 1)
SELECT * FROM mem_info WHERE
state != 1
-- ±ê¼ÇΪɾ³ý
UPDATE mem_info SET FDeleted = 0
UPDATE mem_info SET FDeleted = 1 WHERE card_id IS NULL
SELECT * FROM info_storage
SELECT * FROM JiNan_AIShangPin_MeiLianDian..TCompany
--Ãŵê
UPDATE mem_info SET FCompId = 1
UPDATE mem_info SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('007') WHERE fz = 1001
UPDATE mem_info SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('008') WHERE fz = 1002
UPDATE mem_info SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('009') WHERE fz = 1003
UPDATE mem_info SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('010') WHERE fz = 1005
--»áÔ±ID£¬£«100000
UPDATE mem_info SET FMemId = JiNan_AIShangPin_MeiLianDian.dbo.FNNewId()
--ÐÕÃû
UPDATE mem_info SET FName = ISNULL(ISNULL(mem_name,tel_no),mem_id)
--µç»°
UPDATE mem_info SET FMobile = ISNULL(tel_no,'')
--ÐÔ±ð
UPDATE mem_info SET FGender = 0--CASE WHEN sex = 'true' THEN 1 ELSE 0 END
--CreateDate
--¿¨
--¿¨ID
UPDATE mem_info SET FCardId = abs( CAST( CAST(newid() AS BINARY(16)) AS BIGINT))
--¿¨ºÅ
UPDATE mem_info SET FCardNO = card_id where card_id is not null
--Óà¶î
UPDATE mem_info SET FBalance = balance
--»ý·Ö
--UPDATE mem_info SET FPoint = CardPoint
--¿ª¿¨ÈÕÆÚ
UPDATE mem_info SET FCreateDate = open_date
--ÓÐЧÆÚ
UPDATE mem_info SET FExpiredDate = dateadd(year,100,open_date)
--ÃÜÂë
--UPDATE mem_info SET FPassword = ISNULL(CardPsw,'')
--±¸×¢
UPDATE mem_info SET FCardMemo = isnull(mem,'')
UPDATE mem_info SET FCardState = 1
UPDATE mem_info set FCardState = 4 WHERE state != 1
--´¦ÀíÖظ´µÄ¿¨ºÅ
UPDATE mem_info SET FCardNo = '' + FCardNo
WHERE FCardNo IN( SELECT FCardNo
FROM JiNan_AIShangPin_MeiLianDian..TMemberCard)
AND FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('007')
UPDATE mem_info SET FCardNo = '' + FCardNo
WHERE FCardNo IN( SELECT FCardNo
FROM JiNan_AIShangPin_MeiLianDian..TMemberCard)
AND FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('008')
UPDATE mem_info SET FCardNo = 'TC' + FCardNo
WHERE FCardNo IN( SELECT FCardNo
FROM JiNan_AIShangPin_MeiLianDian..TMemberCard)
AND FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('009')
UPDATE mem_info SET FCardNo = 'TD' + FCardNo
WHERE FCardNo IN( SELECT FCardNo
FROM JiNan_AIShangPin_MeiLianDian..TMemberCard)
AND FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('010')
UPDATE mem_info SET FMemNO = FCardNo
ALTER TABLE mem_info ADD FIndex INT IDENTITY(1,1)
--¸üлáÔ±±àºÅ
UPDATE A
SET A.FMemNO = B.FCardNo
FROM mem_info AS A,mem_info AS B,(SELECT FMemId,MIN(FIndex) AS FIndex FROM mem_info GROUP BY FMemId) AS C
WHERE A.FMemId = B.FMemId
AND B.FMemId = C.FMemId
AND B.FIndex =C.FIndex
SELECT * FROM mem_info WHERE FMemNO = ''
SELECT FMemId,SUM(1)
FROM mem_info
WHERE FDeleted = 0
GROUP BY FMemId
HAVING(SUM(1) > 1)
SELECT * FROM mem_info WHERE FCardNo = ''
SELECT * FROM mem_info WHERE FMemNO = ''
SELECT FMemNO,sum(1)
FROM mem_info
WHERE FDeleted = 0
GROUP BY FMemNo
HAVING(SUM(1) > 1)
SELECT A.FName,A.FMobile,* FROM Card AS B,Guest AS A
WHERE B.FCardNo in(
SELECT FCardNo
FROM Card
WHERE FDeleted = 0
--AND bChain = 0
GROUP BY FCardNo
HAVING(SUM(1) > 1)
)
AND B.FDeleted = 0
AND A.FDeleted= 0
AND A.FMemId = B.FMemId
ORDER BY FCardNo
INSERT INTO JiNan_AIShangPin_MeiLianDian..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,
JiNan_AIShangPin_MeiLianDian.dbo.FNGetFirstPinYin(FName) as fcode,
0 AS FTypeId,
FCompId AS FCompId,
FCreateDate ,
FGender AS FGender,
'G' AS FBirthdayType,
FBirthday AS FBirthday,
'' AS FTelephone,
ISNULL(FMobile,'') AS FMobilePhone,
'' AS FQQ,
'' AS FWeChat,
'' AS FIdCard,
'' AS FEmail,
'' AS FAddress,
0 AS FProId,
ISNULL('','') AS FCPW,
'' AS FQPW,
0 AS FChargeEmpId,
ISNULL( FPoint,0) AS FPoint,
1 AS FRecvConsSMS,
1 AS FRecvBulkSMS,
ISNULL('','') AS FMemo,
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
-- into #t
from mem_info
WHERE FDeleted = 0
SELECT FMemId,sum(1)
FROM #t
GROUP BY FMemId
HAVING(SUM(1) > 1)
SELECT * FROM mem_info WHERE FMemId = 4632873443776940758
SELECT * FROM #T WHERE FMemNO = 'NO2YK20238'
INSERT INTO JiNan_AIShangPin_MeiLianDian..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 JiNan_AIShangPin_MeiLianDian..TMemberCardType WHERE FId = FCardTypeId) AS FValueType,
FCompId AS FCompId,
FMemId AS FMemId,
1 AS FState,
FExpiredDate AS FCreateDate,
FExpiredDate,
0 AS FTotalTimes,
0 AS FUsedTimes,
FCompId AS FSaleCompId,
0 AS FSaleBillId,
FCardMemo AS FMemo
FROM mem_info
WHERE FDeleted = 0
update TMemberCardAccount SET FExpiredDate = null
WHERE FCardTypeId IS NOT NULL
INSERT JiNan_AIShangPin_MeiLianDian..TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
SELECT FMemId,JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,null AS FExpiredDate,''
FROM mem_info AS A
WHERE FDeleted = 0
INSERT JiNan_AIShangPin_MeiLianDian..TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
select JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),A.FMemId,A.FCardId,3,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'´Ó÷ÈÐãÖе¼Èë'
FROM mem_info AS A
WHERE FDeleted = 0
SELECT * FROM TMemberCard WHERE FExpiredDate < '2022-01-01'
UPDATE TMemberCardAcctHist SET FMemo = ''
SELECT * FROM TImpTransLog WHERE ¿Í»§±àºÅ = 'A020935'
update A
SET A.FMemId
SELECT * FROM TMemberCard WHERE FId = 5494058162892437466
UPDATE A
SET A.FExpiredDate = B.FExpiredDate
FROM TMemberCard AS A,mem_info3 AS B
WHERE A.FCardId = B.FCardId
SELECT * FROM mem_info3
UPDATE A
SET A.FMemo = B.Rem
FROM TMemberCard AS A,mem_info3 AS B
WHERE A.FCardId = B.FCardId
AND B.Rem IS NOT NULL
SELECT * FROM TMemberCardType
UPDATE TMemberCardType SET FId = FNo + 1000 WHERE FId > 0
UPDATE TMemberCard SET FTypeId = 0
DELETE TMemberCardTypeSUB
UPDATE A
SET A.FTypeId = B.CType + 1000
FROM TMemberCard AS A,mem_info3 AS B
WHERE A.FCardId = B.FCardId
UPDATE mem_info3 SET FCardTypeId = CType + 1000
SELECT * FROM TMemberCard WHERE FMemo != ''
delete mem_info3 where CUSTNO IN(SELECT CUSTNO FROM mem_info2)
ALTER TABLE mem_fund ADD FCompId BIGINT
UPDATE mem_fund SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('001') WHERE mach = '1001'
UPDATE mem_fund SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('008') WHERE mach = '1002'
UPDATE mem_fund SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('009') WHERE mach = '1003'
UPDATE mem_fund SET FCompId = JiNan_AIShangPin_MeiLianDian.dbo.FNCompId('010') WHERE mach = '1005'
DELETE TMemberOldTransHist
INSERT JiNan_AIShangPin_MeiLianDian..TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
SELECT JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),M.FMemId,fund_time,M.FCardId,A.FCompId,'DR',CASE WHEN fund_Type = 1 THEN '³äÖµ' ELSE 'Ïû·Ñ' END,'',a.mem,0,0,money ,'','',''
FROM mem_fund AS A ,
mem_info AS M
WHERE A.mem_id = M.mem_id
SELECT * FROM mem_item
WHERE mem_id = '203761'
SELECT * FROM info_item WHERE item_id IN(select item_id from mem_item)
--ÁƳÌ
ALTER TABLE info_item ADD FId BIGINT
ALTER TABLE info_item ADD FCourseId BIGINT
UPDATE info_item SET FId = JiNan_AIShangPin_MeiLianDian.dbo.FNNewId()
UPDATE info_item SET FCourseId = JiNan_AIShangPin_MeiLianDian.dbo.FNNewId()
INSERT JiNan_AIShangPin_MeiLianDian..TItem(FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FStatTimes,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking,FDisplay)
SELECT FId,'' + item_id,'' + item_id,item_name,item_name,0,JiNan_AIShangPin_MeiLianDian.dbo.FNGetFirstPinYin(item_name),'',1,1,1,'','','',1,Price,Price,0,0,1,0,0,1,1
FROM info_item
WHERE item_id IN(select item_id from mem_item)
INSERT JiNan_AIShangPin_MeiLianDian..TItemSub(FId,FCompId,FItemId,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking,FEnabled)
SELECT JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),C.FId,I.FId,I.FPrice,I.FVipPrice,I.FTime,I.FDctId,I.FPointMode,I.FPointValue,I.FDeptId,I.FAllowBooking,I.FEnabled
FROM JiNan_AIShangPin_MeiLianDian..TItem AS I,JiNan_AIShangPin_MeiLianDian..TCompany AS C
WHERE I.FId != 0
AND C.FId != 0
AND I.FId IN(SELECT FId FROM info_item)
AND C.FNo IN('001')
INSERT INTO JiNan_AIShangPin_MeiLianDian.. TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
SELECT FCourseId,
'' + item_id + '',
item_name ,
JiNan_AIShangPin_MeiLianDian.dbo.FNGetFirstPinyin(item_name) AS FBriefCode,
FId AS FItemId,
0 AS FPackId,
1 AS FSequence,
0 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,
0 AS FPrice,
0 AS FAmount,
1 AS FCalcMode
FROM info_item
WHERE item_id IN(SELECT item_id FROM mem_item)
--ÁƳÌ
ALTER TABLE mem_item ADD FCardTypeId BIGINT
ALTER TABLE mem_item ADD FItemId BIGINT
ALTER TABLE mem_item ADD FRemainTimes INT
ALTER TABLE mem_item ADD FPurTimes INT
ALTER TABLE mem_item ADD FUsedTimes INT
ALTER TABLE mem_item ADD FPurAmount DECIMAL(18,6)
ALTER TABLE mem_item ADD FCreateDate DATETIME
ALTER TABLE mem_item ADD FExpiredDate DATETIME
ALTER TABLE mem_item ADD FCompId BIGINT
ALTER TABLE mem_item ADD FCardId BIGINT
ALTER TABLE mem_item ADD FMemId BIGINT
ALTER TABLE mem_item ADD FMemo VARCHAR(1000)
UPDATE mem_item SET FCardId = JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),FPurAmount = 0
UPDATE A
SET A.FCardTypeId = B.FCourseId,
A.FItemId = B.FId
FROM mem_item AS A,info_item AS B
WHERE A.item_id = b.item_id
UPDATE mem_item SET FPurTimes = sum_t
UPDATE mem_item SET FUsedTimes = pay_t
UPDATE A
SET A.FCreateDate = B.FCreateDate,
A.FMemId = B.FMemId,
a.fcompId = B.FCompId
FROM mem_item AS A,mem_info AS B
WHERE A.mem_id = b.mem_id
SELECT * FROM mem_item
use JiNan_AIShangPin_MeiLianDian
EXEC PInsertSystemParam 'AllowModifyCourseConsumePrice',Boolean,False,'ÁƳ̿¨Ïû·Ñʱ,ÔÊÐíÐ޸ĵ¥¼Û',''
SELECT * FROM TMemberCardType
use jinan_fuhang
INSERT JiNan_AIShangPin_MeiLianDian..TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
SELECT FCardId,FMemId,FCardTypeId,0,FItemId,FCompId,FPurTimes,FUsedTimes,FPurAmount,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'´Ó·ÉÔ¾µ¼Èë',1,0
FROM mem_item AS A
WHERE FMemId IS NOT NULL
INSERT INTO JiNan_AIShangPin_MeiLianDian..TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,FCompId,FBillType,FBizType,FBillId,FBillNo,FBillDetailId,FRecordTime)
SELECT JiNan_AIShangPin_MeiLianDian.dbo.FNNewId(),FMemId,A.FCardId AS FCardId,0, ISNULL(FCardTypeId,0),getdate(),FPurTimes,0,FUsedTimes,0,FCompId,'DR','Import',0,'',0,getdate()
FROM mem_item AS A
WHERE FMemId IS NOT NULL
use JiNan_AIShangPin_MeiLianDian
UPDATE TMemberCard SET FCardNo = REPLACE(FCardNo,' ','')
UPDATE TMember SET FMemNo = REPLACE(FMemNo,' ','')
UPDATE TMember SET FName = REPLACE(FName,' ','')
UPDATE TMember SET FMobilePhone = REPLACE(FMobilePhone,' ','')
UPDATE TMemberCard SET FMemo = REPLACE(FMemo,' ','')
WHERE FMemId IN(SELECT FMemID FROM jinan_fuhang..mem_info)
UPDATE TItem SET FNo = REPLACE(FNo,' ','')
UPDATE TItem SET FName = REPLACE(FName,' ','')
SELECT info_item.item_id , info_item.item_name , info_item.price , info_item.item_sort FROM info_item WHERE ( info_item.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
SELECT doc_m.times , doc_m.cash , doc_m.card , doc_item.serial_no , doc_item.item_id , doc_item.emp_id , doc_item.emp_a , doc_item.emp_b , doc_item.doc_id , doc_m.doc_date , doc_item.amount , doc_item.money , doc_m.emp_id
FROM doc_m , doc_item
WHERE ( doc_m.doc_id = doc_item.doc_id ) and ( ( doc_m.mem_id = '00002' ) )
go
SELECT info_ware.ware_id , info_ware.ware_name , info_ware.consume_p , info_ware.ware_sort , info_ware.unit FROM info_ware WHERE ( info_ware.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
ALTER TABLE doc_m ADD FMemId BIGINT
UPDATE A
SET A.FMemId = B.FMemId
FROM doc_m AS A,mem_info AS B
WHERE A.mem_id = b.mem_id
select * from mem_Info
INSERT qingdao_fr.dbo.TMemberOldTransHist(FId,FCompId,FMemId,FTime,FCardId,FBIllType,FBizType,FTransNo,FCOntent,FPrice,FQuantity,FAmount,FPayment,Femployee,FMemo)
SELECT qingdao_fr.dbo.FNNewId(), 1,doc_m.FMemId, doc_m.doc_date , 0,'DR' ,'Import' ,doc_m.doc_id,info_item.item_name,doc_item.price, doc_item.amount , doc_item.money , '',emp_Info.emp_name,''
FROM doc_m ,doc_item ,emp_info ,info_item
where doc_m.doc_id = doc_item.doc_id
AND emp_info.emp_id = doc_item.emp_id
AND info_item.item_id = doc_item.item_id
AND doc_m.FMemId IS NOT NULL