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.
495 lines
15 KiB
495 lines
15 KiB
|
|
use QingDao_YanZhi
|
|
|
|
SELECT * FROM imp_member
|
|
WHERE FMemNo iS NULL
|
|
|
|
|
|
WHERE IsDel = 1
|
|
|
|
ORDER BY Id DESC
|
|
|
|
|
|
ALTER TABLE imp_member ADD FCompId BIGINT
|
|
ALTER TABLE imp_member ADD FMemId AS 100000 + ID
|
|
ALTER TABLE imp_member ADD FName AS Name
|
|
ALTER TABLE imp_member ADD FGender AS CASE Sex WHEN 0 THEN 1 ELSE 0 END
|
|
ALTER TABLE imp_member ADD FBriefCode AS HelpMemory
|
|
ALTER TABLE imp_member ADD FMobile AS PhoneNum
|
|
ALTER TABLE imp_member ADD FCreateDate AS AddDate
|
|
ALTER TABLE imp_member ADD FMemo AS Remark
|
|
ALTER TABLE imp_member ADD FBirthday AS CASE WHEN ISNULL(Birth,'') = '' THEN '' ELSE CASE WHEN LEN(Birth) < 12 THEN '9999-' ELSE '' END + REPLACE(REPLACE(Birth,'BTrue',''),'BFalse','') END
|
|
ALTER TABLE imp_member ADD FBirthdayType AS CASE WHEN Birth LIKE '%BFalse%' THEN 'L' ELSE 'G' END
|
|
|
|
ALTER TABLE imp_member ADD FMemNo VARCHAR(50)
|
|
|
|
SELECT * INTO TImpMemberCard_BAK FROM imp_member_card
|
|
|
|
ALTER TABLE imp_member_card ADD FCardNo VARCHAR(50)
|
|
|
|
--ALTER TABLE imp_member_card ALTER COLUMN ADDDATE VARCHAR(20)
|
|
|
|
ALTER TABLE imp_member_card DROP COLUMN FCreateDate
|
|
|
|
ALTER TABLE imp_member_card ADD FMemId AS 100000 + GuestId
|
|
ALTER TABLE imp_member_card ADD FCardId AS 100000 + ID1
|
|
ALTER TABLE imp_member_card ADD FCardTypeId AS CardTypeId
|
|
ALTER TABLE imp_member_card ADD FBalance AS Balance
|
|
ALTER TABLE imp_member_card ADD FCreateDate AS AddDate
|
|
ALTER TABLE imp_member_card ADD FExpiredDate AS EndDate
|
|
ALTER TABLE imp_member_card ADD FValueType AS 1
|
|
ALTER TABLE imp_member_card ADD FCompId BIGINT
|
|
ALTER TABLE imp_member_card ADD FCardState AS 1
|
|
|
|
ALTER TABLE imp_member_card ADD FMemo VARCHAR(2000)
|
|
ALTER TABLE imp_member_card ADD FCourseId BIGINT
|
|
ALTER TABLE imp_member_card ADD FItemId BIGINT
|
|
ALTER TABLE imp_member_card ADD FRemainTimes DECIMAL(18,6)
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardIndex INT
|
|
|
|
SELECT EndDate FROM imp_member_card
|
|
|
|
|
|
--Ãŵê
|
|
ALTER TABLE imp_company ADD FCompId BIGINT
|
|
|
|
select * from imp_company
|
|
|
|
UPDATE imp_company SET FCompId = 1
|
|
|
|
|
|
|
|
-- ALTER TABLE TMemberCardType ALTER COLUMN FName VARCHAR(100) NOT NULL DEFAULT ''
|
|
--¿¨Àà±ð
|
|
|
|
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 = ID,ID,REPLACE(dbo.FNToDBC(TypeName),' ',''),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 imp_card_type
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
SELECT dbo.FNNewId(),C.FCompId,I.ID,1,1,1
|
|
FROM imp_card_type AS I,imp_company AS C
|
|
WHERE I.Id > 1
|
|
AND I.ShopGuid = C.ShopGuid
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
|
|
|
|
--ÁƳÌ
|
|
SELECT dbo.FNNewId() AS FId,
|
|
dbo.FNNewId() AS FCourseId,
|
|
'MS' + ItemsId AS FNo,
|
|
ItemsName AS FName
|
|
INTO imp_course
|
|
FROM imp_member_card
|
|
WHERE AccountType = 2
|
|
GROUP BY ItemsId,ItemsName
|
|
|
|
|
|
INSERT TItem(FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FStatTimes,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking)
|
|
SELECT FId,FNo,FName,FName,FName,0,dbo.FNGetFirstPinYin(FName),'''',1,1,1,'''','''','''',1,0,0,0,0,0,0,0,1
|
|
FROM imp_course
|
|
|
|
|
|
INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
|
|
SELECT FCourseId AS FId,
|
|
I.FNo + 'L1',
|
|
I.FName + '-' + 'ÁƳÌ1' AS FName,
|
|
'' AS FBriefCode,
|
|
I.FId AS FItemId,
|
|
0 AS FPackId,
|
|
1 AS FSequence,
|
|
(SELECT TOP 1 FId FROM TBasicType WHERE FKey = 'CourseType') 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 imp_course AS I
|
|
|
|
|
|
|
|
|
|
|
|
--Ãŵê
|
|
UPDATE A
|
|
SET A.FCompId = B.FId
|
|
FROM imp_company AS A,TCompany AS B
|
|
WHERE B.FWebsite = A.ShopName
|
|
|
|
|
|
--
|
|
UPDATE A
|
|
SET A.FCompId = B.FCompId
|
|
FROM imp_member AS A,imp_company AS B
|
|
WHERE A.ShopGUID = B.ShopGUID
|
|
|
|
UPDATE A
|
|
SET A.FCompId = B.FCompId
|
|
FROM imp_member_card AS A,imp_company AS B
|
|
WHERE A.ShopGUID = B.ShopGUID
|
|
|
|
--¿¨ºÅ
|
|
CREATE INDEX IX_TImpMemberCard_CardNum ON imp_member_card(CardNum)
|
|
CREATE INDEX IX_TImpMemberCard_CardNo ON imp_member_card(FCardNo)
|
|
|
|
UPDATE imp_member_card SET FCardIndex = 0;
|
|
|
|
|
|
UPDATE A
|
|
SET A.FCardIndex =
|
|
(SELECT COUNT(1) FROM imp_member_card AS B
|
|
WHERE B.CardNum = A.CardNum
|
|
|
|
AND (B.AddDate > A.AddDate OR (B.AddDate = A.AddDate AND A.ID1 < B.ID1)) AND B.AccountType = 1)
|
|
FROM imp_member_card AS A
|
|
WHERE A.AccountType = 1
|
|
|
|
|
|
SELECT * FROM imp_member_card
|
|
|
|
ALTER TABLE imp_member_card ALTER COLUMN Id1 INT
|
|
ALTER TABLE imp_member_card ALTER COLUMN CardNum VARCHAR(200)
|
|
|
|
CREATE INDEX IX_MEMBER_CARD_NUM ON imp_member_card(CardNum)
|
|
|
|
|
|
|
|
|
|
SELECT CardNum INTO #Card
|
|
FROM imp_member_card AS A
|
|
WHERE A.AccountType = 1
|
|
GROUP BY CardNum
|
|
HAVING SUM(1) > 1
|
|
|
|
|
|
|
|
--¿¨ºÅ
|
|
|
|
UPDATE imp_member_card SET FCardNo = CardNum
|
|
|
|
SELECT * FROM imp_member_card
|
|
|
|
UPDATE A
|
|
SET A.FCardNo = A.CardNum + CAST(A.FCardIndex + 1 AS VARCHAR)
|
|
FROM imp_member_card AS A
|
|
WHERE A.FCardIndex > 0
|
|
AND A.AccountType = 1
|
|
|
|
|
|
UPDATE A
|
|
SET A.FMemNo = A.FMobile
|
|
FROM imp_member AS A
|
|
|
|
UPDATE A
|
|
SET A.FMemNo = A.FName
|
|
FROM imp_member AS A
|
|
WHERE ISNULL(FMobile,'') = ''
|
|
|
|
UPDATE A
|
|
SET A.FMemNo = B.FCardNo
|
|
FROM imp_member AS A,imp_member_card AS B
|
|
WHERE A.Id = B.GuestId
|
|
AND B.FCardIndex= 0
|
|
AND B.FCardNo != '\'
|
|
|
|
SELECT * FROM imp_member_card
|
|
WHERE GuestId IN(10572
|
|
,10585)
|
|
|
|
|
|
SELECT * FROM imp_member
|
|
WHERE FMemNo iS NULL
|
|
|
|
SELECT * FROM imp_member WHERE FMemNo = '03225'
|
|
|
|
SELECT * FROM imp_member_card where fcardno = '03225'
|
|
|
|
SELECT FMemNo,SUM(1) FROM imp_member
|
|
WHERE Id IN(SELECT GuestId FROM imp_member_card)
|
|
GROUP BY FMemNo
|
|
ORDER BY SUM(1) DESC
|
|
|
|
SELECT * FROM imp_member_card WHERE GuestId IN(
|
|
SELECT * FROM imp_member WHERE FMemNo = '13206333611'
|
|
)
|
|
|
|
SELECT * FROM imp_member_card
|
|
GROUP BY CardTypeId,CardTypeName
|
|
|
|
|
|
SELECT * FROM imp_member_card
|
|
WHERE FCardNo = '90187'
|
|
AND AccountType = 1
|
|
|
|
SELECT FCardNo
|
|
FROM imp_member_card
|
|
WHERE AccountType = 1
|
|
GROUP BY FCardNo
|
|
HAVING(SUM(1)) > 1
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
--±¸×¢
|
|
UPDATE imp_member_card SET FMemo = REMARK
|
|
|
|
UPDATE imp_member_card SET FCardNo = 'A' + FCardNo
|
|
WHERE FCardNo IN(SELECT FMemNo FROM TMember UNION ALL SELECT FCardNO FROM TMemberCard)
|
|
|
|
|
|
|
|
--²åÈë»áÔ±
|
|
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 A.FMemId,
|
|
A.FMemNo,
|
|
A.FName,
|
|
DBO.FNGetFirstPinYin(A.FName),
|
|
0 AS FTypeId,
|
|
FCompId,
|
|
A.FCreateDate,
|
|
A.FGender,
|
|
A.FBirthdayType AS FBirthdayType,
|
|
A.FBirthday,
|
|
'' AS FTelephone,
|
|
A.FMobile,
|
|
'' AS FQQ,
|
|
'' AS FWeChat,
|
|
'' AS FIdCard,
|
|
'' AS FEmail,
|
|
'' AS FAddress,
|
|
0 AS FProId,
|
|
ISNULL('','') AS FCPW,
|
|
ISNULL('','') AS FQPW,
|
|
0 AS FChargeEmpId,
|
|
0 AS FPoint,
|
|
1 AS FRecvConsSMS,
|
|
1 AS FRecvBulkSMS,
|
|
A.FMemo AS FMemo,
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
from imp_member AS A
|
|
WHERE A.IsDel = 0
|
|
AND A.Id IN(SELECT GuestId FROM imp_member_card)
|
|
|
|
|
|
INSERT INTO dbo.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,
|
|
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 imp_member_card
|
|
WHERE AccountType = 1
|
|
AND IsDel = 'false'
|
|
|
|
|
|
SELECT * FROM imp_member_card
|
|
|
|
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 imp_member_card
|
|
WHERE FCardId IS NOT NULL
|
|
AND AccountType = 1
|
|
AND IsDel = 'false'
|
|
|
|
|
|
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,imp_member_card AS D
|
|
where C.FCardId = A.FCardId
|
|
AND C.FCardId = D.FCardId
|
|
AND AccountType = 1
|
|
AND IsDel = 'false'
|
|
|
|
|
|
--ÁƳÌ
|
|
UPDATE A
|
|
SET A.FItemId = B.FId,
|
|
A.FCourseId = B.FCourseId,
|
|
A.FRemainTimes = Times
|
|
FROM imp_member_card AS A,imp_course AS B
|
|
WHERE A.ItemsName = B.FName
|
|
AND A.AccountType = 2
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FUsedPurTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
SELECT ID1,FMemId,FCourseId,0,FItemId,FCompId,FRemainTimes,ISNULL(0,0),0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'´Ó÷ÈÐãµ¼Èë',1,ISNULL(0,0)
|
|
FROM imp_member_card
|
|
--WHERE FCourseId IS NOT NULL
|
|
WHERE AccountType = 2
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,
|
|
FCompId,
|
|
FBillType,FBizType,FBillId,FBillNo,FBillDetailId)
|
|
|
|
SELECT dbo.FNNewId(),FMemId,ID1,0,FCourseId,FTime = getdate(),FRemainTimes,0,0,0,
|
|
FCompId,
|
|
'DR','Import',0,'',0
|
|
FROM imp_member_card
|
|
WHERE AccountType = 2
|
|
|
|
UPDATE TMemberCardType SET FName = '[A]'+ FName WHERE FId IN(SELECT Id FROM imp_card_type)
|
|
|
|
--²úÆ·
|
|
SELECT * FROM TBasicType
|
|
|
|
INSERT TBasicType(FId,FKey,FNo,FName,FParentId,FDescription,FCustom,FOrder,FAllowEdit,FEnabled)
|
|
SELECT ProTypeID,'GoodsType',ProTypeID,MAX(ProTypeName),0,'','',0,-1,1
|
|
FROM imp_goods
|
|
GROUP BY ProTypeID--,ProTypeName
|
|
|
|
INSERT TBasicTypeSub(FBasicTypeId,FCompId)
|
|
SELECT ProTypeID,FCompId
|
|
FROM imp_goods,imp_company
|
|
GROUP BY ProTypeID,FCompId
|
|
|
|
SELECT * FROM imp_goods WHERE ShopGuid = 'b82b6ecd-7fd6-4fa6-a0fc-18ce7969bfee'
|
|
|
|
|
|
SELECT * FROM imp_company
|
|
|
|
DELETE TGoodsSUb WHERE FGoodsId IN(SELECT ProId FROM imp_goods)
|
|
|
|
ALTER TABLE TImpGoodsDetail ADD TypeId INT
|
|
|
|
UPDATE A
|
|
SET A.TypeId = B.ProTypeId
|
|
FROM TImpGoodsDetail AS A,imp_goods AS B
|
|
WHERE A.Id = B.ProId
|
|
|
|
|
|
INSERT INTO TGoods(FId,FNo,FName,FNoOfPad,FTypeId,FBriefCode,FUnitId,FSalePrice,FPurCostPrice,FSaleCostPrice,FConsCostPrice,FValuationMode,FBarCode,FEnabled,FSpecification,FPurUnitId,FConsUnitId,FSupplierId,FStoreId,FConsStoreId,FSaleStoreId,FMaxStock,FMinStock,FPeriodEnabled,FShelfLife,FDctId,FPointMode,FPointValue,FDeptId,FIsSale,FUnitLock,FDescription,FCustom1,FCustom2,FCustom3)
|
|
SELECT ID,ID,TypeName,ID,FTypeId = TypeId,dbo.FNGetFirstPinYin(TypeName),
|
|
FUnitId = 20006,FSalePrice = TotalPrice,FPurCostPrice = 0,FSaleCostPrice = 0,FConsCostPrice = 0,
|
|
FValuationMode = 0,FBarCode = 0,FEnabled = 1,FSpecification = '',
|
|
FPurUnitId = 0,FConsUnitId = 0,FSupplierId = 0,FStoreId = 0,FConsStoreId= 0,FSaleStoreId= 0,
|
|
FMaxStock= 0,FMinStock= 0,FPeriodEnabled= 0,FShelfLife= 0,FDctId= 0,FPointMode= 0,FPointValue= 0,
|
|
FDeptId= 0,FIsSale = 1,FUnitLock= 0,FDescription= '',FCustom1 = '',FCustom2 = '',FCustom3 = ''
|
|
FROM TImpGoodsDetail
|
|
WHERE ShopGuid IN( 'b82b6ecd-7fd6-4fa6-a0fc-18ce7969bfee','d03ddab5-50ae-4503-9fa6-f388d3e1abd9')
|
|
AND isdel = 'False'
|
|
|
|
|
|
SELECT * FROM TImpGoodsDetail
|
|
|
|
|
|
|
|
select * from TImpGoodsDetail where id = 1377
|
|
SELECT * FROM TGoods WHERE FId > 90000
|
|
|
|
INSERT INTO TGoodsMultiUnit(FId,FGoodsId,FUnitType,FUnitId,FSequence,FConvDir,FConvRate,FSalePrice,FPurCostPrice,FSaleCostPrice,FConsCostPrice,FBarCode,FUnitLock)
|
|
SELECT dbo.FNNewId(),FId,1,FUnitId,1,1,1,FSalePrice,FPurCostPrice,FSaleCostPrice,FConsCostPrice,FBarCode,FUnitLock
|
|
FROM TGoods
|
|
WHERE FId IN(SELECT ID FROM TImpGoodsDetail)
|
|
|
|
|
|
INSERT TGoodsSub(FId,FGoodsId,FCompId)
|
|
SELECT dbo.FNNewId(),A.ID,C.FCompId
|
|
FROM TImpGoodsDetail AS A,imp_company AS C
|
|
WHERE A.ShopGUID = c.ShopGUID
|
|
AND A.ShopGUID = 'b82b6ecd-7fd6-4fa6-a0fc-18ce7969bfee'
|
|
AND A.isdel = 'false'
|
|
AND A.Id IN(SELECT FId FROM TGoods)
|
|
|
|
INSERT TGoodsSub(FId,FGoodsId,FCompId)
|
|
SELECT dbo.FNNewId(),A.ID,C.FCompId
|
|
FROM TImpGoodsDetail AS A,imp_company AS C
|
|
WHERE A.ShopGUID != 'b82b6ecd-7fd6-4fa6-a0fc-18ce7969bfee'
|
|
AND C.ShopGUID != 'b82b6ecd-7fd6-4fa6-a0fc-18ce7969bfee'
|
|
AND A.Id IN(SELECT FId FROM TGoods)
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
INSERT TGoodsSub(FId,FGoodsId,FCompId)
|
|
SELECT dbo.FNNewId(),A.FGoodsId,C.FId
|
|
FROM TCompany AS C,TGoodsSub AS A
|
|
WHERE A.FCompId= 5061862835603384013
|
|
AND C.FId IN(4749754343985359438,5588794236132881698)
|
|
|
|
|
|
|
|
DELETE TGoodsSub WHERE FCompId IN(4749754343985359438,5588794236132881698)
|
|
|
|
DELETE TGoodsSub WHERE FGoodsId < 99999
|
|
|
|
SELECT * FROM TGoods WHERE FId = 4657648524007439829
|
|
|
|
|
|
SELECT * FROM imp_goods
|
|
select * from TBasicType WHERE FKey = 'GoodsType'
|
|
|
|
|
|
|
|
--½»Ò×ÀúÊ·
|
|
|
|
|
|
ALTER TABLE imp_trans_hist ADD FMemId BIGINT
|
|
ALTER TABLE imp_trans_hist ADD FCompId BIGINT
|
|
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId,
|
|
A.FCompId = B.FCompId
|
|
FROM imp_member AS B,imp_trans_hist AS A
|
|
WHERE A.GuestId = B.ID
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
SELECT dbo.FNNewId(),A.FMemId,A.ReceiptDate,0,A.FCompId,'DR','Import',ReceiptNum,ProName,0,0,CostTotalMOney,'','',''
|
|
FROM imp_trans_hist AS A
|
|
|
|
|
|
|