SELECT * FROM TWebAppInfo SELECT * FROM TCompany SELECT * FRO SELECT * FROM TWeChatUser SELECT * FROM TImpCourse WHERE FItemID = 0 select * from TMemb WHERE FMemId = 439201511111324508 select * from TImpCourse WHERE FMemId = 439201511111324508 SELECT * FROM TImpCard WHERE FCardNo = 'jb0617' SELECT * FROM TItem WHERE FName = '皇室肩颈减压' UPDATE A SET A.FItemId = B.FItemId, A.FCourseId = B.FId FROM TImpCourse AS A,TCourse AS B, TItem AS C WHERE C.FName = A.LCXMMC AND C.FId = B.FItemId AND A.FItemID = 0 update a set a.fiTEMid = b.fiTEMiD ,A.FCOURSEID = B.FCOURSEId FROM TImpCourse AS B,TMemberCourse AS A WHERE A.FId = b.fid AND A.FItemId = 0 SELECT * FROM TItem WHERE FId = 8290968487171423457 SELECT M.FCompId,M.FMemNo,M.FName,A.FId,B.FName,C.LCXMMC FROM TConsumeItem AS A,TItem AS B,TImpCourse AS C,TMember AS M WHERE A.FMemCourseId IN( SELECT A.FId FROM TImpCourse AS A,TItem AS I WHERE A.FItemId = I.FId AND A.LCXMMC != I.FName ) AND A.FItemId = B.FId AND C.FId = A.FMemCourseId AND M.FMemId = C.FMemId UPDATE TItem SET FName = REPLACE(REPLACE( REPLACE( FName,' ',''),'(','('),')',')') UPDATE TImpCourse SET FItemName = REPLACE(REPLACE( REPLACE( FItemName,' ',''),'(','('),')',')') UPDATE TImpCourse SET LCXMMC = REPLACE(REPLACE( REPLACE( LCXMMC,' ',''),'(','('),')',')') SELECT IDENTITY(INT,1,1) AS FIndex, I.FNo,A.FItemName,I.FName,A.LCXMBM into #NewItem FROM TImpCourse AS A,TItem AS I WHERE 1=1 -- AND A.FId = 5201505311324373001 AND A.FItemID = I.FId AND REPLACE(REPLACE( REPLACE(A.FItemName,' ',''),'(','('),')',')') != REPLACE(REPLACE( REPLACE(I.FName,' ',''),'(','('),')',')') --AND I.FName = '(身体)神的诱惑' AND FItemName NOT IN(SELECT FName FROM TItem) GROUP BY I.FNo,A.FItemName,I.FName,A.LCXMBM ORDER BY SUM(1) DESC SELECT * FROM TImpCourse WHERE FItemName LIKE '%禅意悠悠2代' SELECT * FROM #NewItem ALTER TABLE #NewItem ADD FNewItemNo VARCHAR(20) UPDATE #NewItem SET FNewItemNo = 'L' + CAST(FIndex + 129 AS VARCHAR) update #NewItem SET FIndex = FIndex + 129 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 dbo.FNNewId(),FNewITEMNo,FNewITEMNo,FItemName,FItemName,0,dbo.FNGetFirstPinYin(FItemName),'''',1,1,1,'''','''','''',1,0,0,0,0,0,0,0,1 FROM #NewItem SELECT * FROM TCourse INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode) SELECT dbo.FNNewId() AS FId, I.FNo + 'L1', I.FName + '-' + '疗程1' AS FName, '' AS FBriefCode, I.FId AS FItemId, 0 AS FPackId, 1 AS FSequence, 4822791688865541970 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 TItem AS I WHERE FNo IN(SELECT FNewItemNo FROM #NewItem) UPDATE A SET A.FNewItemId = B.FItemId, A.FNewCourseId = B.FId FROM TCourse AS B,TImpCourse AS A,TItem AS I WHERE I.FId = B.FItemId AND I.FName = A.FItemName AND A.FItemName IN(SELECT DISTINCT A.FItemName FROM TImpCourse AS A,TItem AS B WHERE B.FId = A.FItemId AND A.FItemName != B.FName) (身体)禅意悠悠2代 SELECT * FROM TCOnsumeItem WHERE FMemCourseId IN( SELECT A.FId FROM TImpCourse AS A,TItem AS I WHERE 1=1 -- AND A.FId = 5201505311324373001 AND A.FItemID = I.FId AND A.FItemName != I.FName AND A.FItemName != '(身体)禅意悠悠2代' ) SELECT * FROM TItem WHERE FName LIKE '%脱毛%' --AND I.FName = '(身体)神的诱惑' GROUP BY I.FNo,A.LCXMMC,I.FName,A.LCXMBM ALTER TABLE TImpCourse ADD FNewItemId BIGINT ALTER TABLE TImpCourse ADD FNewCourseId BIGINT UPDATE TImpCourse SET FItemName = '(身体)神的诱惑' WHERE FItemName = '神的诱惑' UPDATE TImpCourse SET FItemName = '面雕面部' WHERE FItemName = '(面部)GSD面雕面部' UPDATE TImpCourse SET FItemName = '(面部)补水+生物还原' WHERE FItemName = '补水+生物还原' UPDATE TImpCourse SET FItemName = '草药球' WHERE FItemName = '(身体)热油草药球' UPDATE TImpCourse SET FItemName = '禅意悠悠2代' WHERE FItemName = '(身体)禅意悠悠2代' UPDATE TImpCourse SET FItemName = '(面部)补水+生物还原' WHERE FItemName = '补水+生物还原' UPDATE TImpCourse SET FItemName = '(仪器)面部光热祛痘' WHERE FItemName = '面部光热祛痘' UPDATE TImpCourse SET FItemName = '(仪器)面部光热无痛绝毛' WHERE FItemName = '面部光热无痛绝毛' UPDATE TImpCourse SET FItemName = '(仪器)面颈部冰电胶原新生抗衰' WHERE FItemName = '颈部冰电胶原新生抗衰' UPDATE TImpCourse SET FItemName = '(身体)禅意悠悠' WHERE FItemName = '禅意悠悠' UPDATE TImpCourse SET FItemName = '(仪器)面光电净肤柔敏深层补水' WHERE FItemName = '光电净肤柔敏深层补水' UPDATE TImpCourse SET FItemName = '(仪器)面光电亮颜美白深层补水' WHERE FItemName = '光电亮颜美白深层补水' UPDATE TImpCourse SET FItemName = '(仪器)面光电紧致科技补水' WHERE FItemName = '光电紧致科技补水' UPDATE TImpCourse SET FItemName = '(仪器)面光电凝肌控油深层补水' WHERE FItemName = '光电凝肌控油深层补水' UPDATE TImpCourse SET FItemName = '(仪器)面颈深层活细胞紧致提升' WHERE FItemName = '颈部深层活细胞紧致提升' UPDATE TImpCourse SET FItemName = '(仪器)面部深层活细胞轮廓雕塑' WHERE FItemName = '面部深层活细胞轮廓雕塑' UPDATE TImpCourse SET FItemName = '(仪器)面部光热亮白嫩肤' WHERE FItemName = '面部光热亮白嫩肤' UPDATE TImpCourse SET FItemName = '(仪器)面眼部冰电胶原新生抗衰' WHERE FItemName = '眼部冰电胶原新生抗衰' UPDATE TImpCourse SET FItemName = '(身体)无痛绝毛' WHERE FItemName = '无痛绝毛' UPDATE TImpCourse SET FItemName = '(身体)净化禅' WHERE FItemName = '净化禅' UPDATE TImpCourse SET FItemName = '(身体)君子好逑' WHERE FItemName = '君子好逑' UPDATE TImpCourse SET FItemName = '(身体)生命之花' WHERE FItemName = '生命之花' UPDATE TImpCourse SET FItemName = '(身体)国色天香' WHERE FItemName = '国色天香' UPDATE TImpCourse SET FItemName = '(身体)生命之源' WHERE FItemName = '生命之源' UPDATE TImpCourse SET FItemName = '(身体)深层活细胞美体' WHERE FItemName = '深层活细胞美体' UPDATE TImpCourse SET FItemName = '(身体)密码养生' WHERE FItemName = '密码养生' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(排毒)' WHERE FItemName = '冰电体雕(排毒)' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(负压)' WHERE FItemName = '冰电体雕(负压)' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(射频)' WHERE FItemName = '冰电体雕(射频)' UPDATE TImpCourse SET FItemName = '(身体)四国风情' WHERE FItemName = '四国风情' UPDATE TImpCourse SET FItemName = '(面部)补水+面雕' WHERE FItemName = '补水+面雕' UPDATE TImpCourse SET FItemName = '(面部)深层数码离子补水' WHERE FItemName = '深层数码离子补水' UPDATE TImpCourse SET FItemName = '(面部)柔光嫩肤' WHERE FItemName = '柔光嫩肤' UPDATE TImpCourse SET FItemName = '(面部)柔光祛痘' WHERE FItemName = '柔光祛痘' UPDATE TImpCourse SET FItemName = '(身体)全身减肥' WHERE FItemName = '全身减肥' UPDATE TImpCourse SET FItemName = '(面部)原液' WHERE FItemName = '原液' UPDATE TImpCourse SET FItemName = '(身体)泡澡' WHERE FItemName = '泡澡' UPDATE TImpCourse SET FItemName = '(身体)乳腺疏通' WHERE FItemName = '乳腺疏通' UPDATE TImpCourse SET FItemName = '(身体)鸽子树胸部疏通' WHERE FItemName = '鸽子树胸部疏通' UPDATE TImpCourse SET FItemName = '(身体)鸽子树胸部收紧' WHERE FItemName = '鸽子树胸部收紧' UPDATE TImpCourse SET FItemName = '(面部)韵姿眼护' WHERE FItemName = '韵姿眼护' UPDATE TImpCourse SET FItemName = '(面部)耳烛' WHERE FItemName = '耳烛' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(射频)后背' WHERE FItemName = '冰电体雕(射频)后背' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(射频)腰' WHERE FItemName = '冰电体雕(射频)腰' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(射频)肚子' WHERE FItemName = '冰电体雕(射频)肚子' UPDATE TImpCourse SET FItemName = '(身体)GSD面雕身体' WHERE FItemName = '(身体)面雕身体' UPDATE TImpCourse SET FItemName = '(身体)扶正堂风健康礼盒' WHERE FItemName = '(身体)扶风健康礼盒' UPDATE TImpCourse SET FItemName = '(身体)扶正堂风健康礼盒' WHERE FItemName = '风健康礼盒' UPDATE TImpCourse SET FItemName = '(泡澡)扶正堂风草本SPA精华' WHERE FItemName = '(身体)扶风草本SPA精华' UPDATE TImpCourse SET FItemName = '(泡澡)扶正堂肝胆草本SPA' WHERE FItemName = '(身体)扶肝胆草本SPA精华' UPDATE TImpCourse SET FItemName = '(身体)扶正堂肝胆柔筋健康礼盒' WHERE FItemName = '肝胆柔筋健康礼盒' UPDATE TImpCourse SET FItemName = '(泡澡)扶正堂肝胆草本SPA' WHERE FItemName = '肝胆草本SPA精华' UPDATE TImpCourse SET FItemName = '(身体)扶正堂脾胃美肌健康礼盒' WHERE FItemName = '(身体)扶脾胃美肌健康礼盒' UPDATE TImpCourse SET FItemName = '(身体)扶正堂脾胃美肌健康礼盒' WHERE FItemName = '脾胃美肌健康礼盒' UPDATE TImpCourse SET FItemName = '(身体)扶正堂四大淋巴' WHERE FItemName = '(身体)扶四大淋巴' UPDATE TImpCourse SET FItemName = '(身体)扶正堂四大淋巴' WHERE FItemName = '四大淋巴' UPDATE TImpCourse SET FItemName = '(身体)扶正堂脊柱养护健康礼盒' WHERE FItemName = '(身体)扶脊柱养护健康礼盒' UPDATE TImpCourse SET FItemName = '(身体)扶正堂脊柱养护健康礼盒' WHERE FItemName = '脊柱养护健康礼盒' UPDATE TImpCourse SET FItemName = '(身体)扶正堂韵味女人调养健康' WHERE FItemName = '(身体)扶韵味女人调养健康礼盒' UPDATE TImpCourse SET FItemName = '(身体)扶正堂韵味女人调养健康' WHERE FItemName = '韵味女人调养健康礼盒' UPDATE TImpCourse SET FItemName = '(泡澡)扶正堂韵味女人SPA' WHERE FItemName = '(身体)扶韵味女人草本SPA精' UPDATE TImpCourse SET FItemName = '(面部)水漾凝肌深层滋润护理' WHERE FItemName = '水漾凝肌深层滋润护理' UPDATE TImpCourse SET FItemName = '(面部)眼前一亮特效眼部护理' WHERE FItemName = '眼前一亮特效眼部护理' UPDATE TImpCourse SET FItemName = '(面部)天之娇女莹润保湿护理' WHERE FItemName = '天之娇女莹润保湿护理' UPDATE TImpCourse SET FItemName = '(面部)白衣天使抗敏护理' WHERE FItemName = '白衣天使抗敏护理' UPDATE TImpCourse SET FItemName = '(身体)精油开背' WHERE FItemName = '精油开背' UPDATE TImpCourse SET FItemName = '(身体)扶正堂女人密语胸' WHERE FItemName = '(身体)扶正堂胸部' UPDATE TImpCourse SET FItemName = '' WHERE FItemName = '' UPDATE TImpCourse SET FItemName = '(面部)嘉乐芬人参舒缓SPA' WHERE FItemName = '(面部)嘉乐芬疗程' UPDATE TImpCourse SET FItemName = '(面部)生物还原美容美体' WHERE FItemName = '生物还原美容美体' UPDATE TImpCourse SET FItemName = '(泡澡)扶正堂香艳女人SPA' WHERE FItemName = '(身体)扶香艳女人草本SPA精' UPDATE TImpCourse SET FItemName = '(面部)嘉乐芬人参舒缓SPA' WHERE FItemName = '嘉乐芬疗程' UPDATE TImpCourse SET FItemName = '(面部)GSD面雕' WHERE FItemName = '(面部)GSD面雕面部' UPDATE TImpCourse SET FItemName = '(身体)热油草药球' WHERE FItemName = '(身体)热油草药球' UPDATE TImpCourse SET FItemName = '(身体)热油草药球' WHERE FItemName = '(身体)热油草药球' UPDATE TImpCourse SET FItemName = '禅意悠悠2代' WHERE FItemName LIKE '%禅意悠悠2代' UPDATE TImpCourse SET FItemName = '(身体)禅意悠悠' WHERE FItemName = '禅意悠悠' UPDATE TImpCourse SET FItemName = '(身体)冰电体雕(射频)' WHERE FItemName = '冰电体雕(射频)手臂' UPDATE TImpCourse SET FItemName = '(身体)扶正堂四大淋巴' WHERE FItemName = '四大淋巴' UPDATE TImpCourse SET FItemName = '(泡澡)扶正堂香艳女人SPA' WHERE FItemName = '香艳女人草本SPA精华' UPDATE TImpCourse SET FItemName = '(面部)GSD面雕' WHERE FItemName = '(面部)GSD面雕面部' UPDATE TImpCourse SET FItemName = '(身体)热油草药球' WHERE FItemName = '草药球' UPDATE TImpCourse SET FItemName = '禅意悠悠2代' WHERE FItemName = '(身体)禅意悠悠2代' UPDATE TImpCourse SET FItemName = '(身体)热油草药球' WHERE FItemName = '草药球' UPDATE TImpCourse SET FItemName = '(身体)热油草药球' WHERE FItemName = '面雕面部' ALTER TABLE TImpCourse ADD FItemName VARCHAR(50) UPDATE TImpCourse SET FItemName = LCXMMC SELECT * FROM TImpCourse WHERE LCXMBM = '479' SELECT * FROM TImpCourse WHERE LCXMMC = '面雕面部' --AND A. LCXMMC = '(面部)耳烛' --GROUP BY A.FItemId, A.LCXMMC,I.FName,I.FNo select * from TImpCourse WHERE FItemId = 610 AND LCXMMC = '冰球' SELECT * FROM TCompany SELECT * FROM TMemberCardAccount WHERE FCardId = 253201402251358006 UPDATE TCompany SET FWeChatPayMchId = '1350440301' SELECT * FROM TImpCard WHERE FCardNo = 'QB00001235' ALTER TABLE TImpCard ADD FBalance2 DECIMAL(18,6) UPDATE TImpCard SET FBalance2 = CAST(VIPZSJE AS DECIMAL(18,6)) WHERE VIPZSJE != 0.0 SELECT * FROM TCompany SELECT * FROM TImpCard WHERE FBalance2 != 0 SELECT * FROM TUser WHERE FNo = '0288008' SELECT FCompId FROM TUserAllowCompany WHERE FUserId = 5252777072562267853 SELECT * FROM TCp INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo) SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,10,FBalance2,FBalance2,0,FCreateDate,NULL AS FExpiredDate,'' FROM TImpCard AS A WHERE FCardId IN(SELECT FCardId FROM TMemberCard) AND FBalance2 != 0 SELECT * FROM TGoodsSub WHERE FCompId = 5252777072562267853 INSERT TGoodsSub(FId,FCompId,FGoodsId) SELECT dbo.FNNewId(),C.FId,I.FId FROM TGoods AS I,TCompany AS C WHERE I.FId != 0 AND C.FId = 5070814954448694070 AND NOT EXISTS(SELECT TOP 1 1 FROM TGoodsSub AS B WHERE B.FCompId = C.FId AND B.FGoodsId = I.FId) SELECT * FROM TGoodsSub DELETE TGoodsSub WHERE FCompId = 5070814954448694070 SELECT * FROM TConsumeGoods AS B,TConsumeBill AS A WHERE B.FBILLID = A.FBILLID AND A.FCompId = 5070814954448694070 INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo) select dbo.FNNewId(),A.FMemId,A.FCardId,10,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance2,0,A.FBalance2,0,getdate(),'从老系统导入' FROM TImpCard AS A WHERE FCardId IN(SELECT FCardId FROM TMemberCard) AND FBalance2 != 0 SELECT * FROM TPayAccount