use saidao_appserver SELECT * FROM TClient WHERE FConnectionString LIKE '%m.weixin%' DELETE TClient WHERE FClientId IN() USE YunCheng_ShouXuan SELECT CONVERT(VARCHAR,FTime,23) FROM TMemberCourseLog WHERE FBillType = '' GROUP BY CONVERT(VARCHAR,FTime,23) ORDER BY CONVERT(VARCHAR,FTime,23) SELECT *FROM TMemberCourseLog WHERE FBillType = '' SELECT * FROM TBizLog WHERE FDescription = '修改疗程次数' CREATE FUNCTION FNGetMemo ( @Text VARCHAR(2000) ) RETURNS VARCHAR(111) AS BEGIN RETURN SUBSTRING(@Text,CHARINDEX('备注:',@Text)+3,LEN(@Text)) END GO DROP FUNCTION FNGetCourseId GO CREATE FUNCTION FNGetCourseId ( @Text VARCHAR(2000) ) RETURNS VARCHAR(111) AS BEGIN RETURN SUBSTRING(@Text,CHARINDEX('会员疗程ID:',@Text)+7,19) END GO DROP TABLE #Log SELECT dbo.FNGetMemo(FContent) AS FMemo, dbo.FNGetCourseId(FContent) AS FCardId,FTime INTO #Log FROM TBizLog WHERE FDescription = '修改疗程次数' SELECT * FROM #Log SELECT A.FCardId,A.FMemo FROM #Log AS A,TMemberCourseLog AS B WHERE B.FCardId = A.FCardId AND B.FBillType = '' AND ABS(DATEDIFF(SECOND, B.FRecordTime , A.FTime)) < 3 UPDATE B SET B.FMemo = A.FMemo FROM #Log AS A,TMemberCourseLog AS B WHERE B.FCardId = A.FCardId AND B.FBillType = '' AND ABS(DATEDIFF(SECOND, B.FRecordTime , A.FTime)) < 3