SELECT * FROM TLocalConfig DELETE exec sp_rename 'TLocalConfig.FMachineId','FMachineCode' exec sp_rename 'TLocalConfig.FMachineCode','FMachineCodeA' ALTER TABLE TLocalConfig ADD FMachineCode VARCHAR(128) NOT NULL DEFAULT '' UPDATE TLocalConfig SET FMachineCode = FMachineId ALTER TABLE TLocalConfig DROP COLUMN FMachineCodeA UPDATE TLocalConfig WITH(ROWLOCK) SET FValue = '1' WHERE FMachineCode = 'SH12182A3A88HW96' AND FKey = 'ICComPort' IF @@ROWCOUNT = 0 INSERT TLocalConfig(FMachineCode,FKey,FDataType,FValue) VALUES('SH12182A3A88HW96','ICComPort','Int','1') SELECT * FROM TUser SELECT * FROM TMemberCourse WHERE FId = 7162073597757457445 SELECT * FROM TMemberSaleBill WHERE FBillNo = '0031603290002' SELECT * FROM TBasicType WHERE FKEY LIKE '%DE%' UPDATE TMemberSaleCard SET FDeptId = 8099561182972607434 WHERE FBillId = 5185503490171039918 SELECT * FROM TMember WHERE FMemNo = '9800856' SELECT * FROM TMemberCourse WHERE FMemId = '9182083995067344279' UPDATE TMemberCourse SET FExpiredDate = '9999-12-31' WHERE FExpiredDate IS NULL UPDATE A SET A.FDeptId = B.FDeptId FROM TConsumeItem AS A, ( SELECT A.FDetailId,A.FEmpId,E.FDeptId FROM TCOnsumeItemEmployee AS A, ( SELECT A.FDetailId,MIN(A.FWorkType) AS FWorkType FROM TCOnsumeItemEmployee AS A GROUP BY FDetailId ) AS B,TEmployee AS E WHERE A.FDetailId = B.FDetailId AND A.FWorkType = B.FWorkType AND E.FId = A.FEmpId ) AS B WHERE A.FId = B.FDetailId SELECT * FROM TMemberSaleBill SELECT * FROM TConsumeBill SELECT * FROM TMemberSaleEmployee UPDATE A SET A.FDeptId = (SELECT E.FDeptId FROM TEmployee AS E, TMemberSaleEmployee AS B WHERE E.FId = B.FEmpId AND B.FWorkType = 12001 AND B.FBillId = 5128029051763335961) FROM TMemberSaleCourse AS A WHERE A.FBillId = 5128029051763335961 AND A.FDeptId = 0 SELECT A.FBillId,A.FDeptId,E.FDeptId -- UPDATE A SET A.FDeptid = E.FDeptId FROM TMemberSaleCard AS A,TEmployee AS E,TMemberSaleEmployee AS C WHERE C.FWorkType = 12001 AND A.FBillId = C.FBillId AND E.FId = C.FEmpId UPDATE SELECT * FROM TMemberSaleBill WHERE FBillId = 4724211108015126169