IF OBJECT_ID(N'LowTempForJohnsonSterilizerRecord', 'U') IS NOT NULL
BEGIN
IF OBJECT_ID(N'LowTempForJohnsonRecord', 'U') IS NOT NULL
BEGIN
	-- 表数据迁移到新表
   insert into LowTempForJohnsonRecord select cycleCounter,endDate,machineNumber,programName,stageTotalMin,stageTotalSec,startDate,SterilizationRecordId,totalCycleCounter from LowTempForJohnsonSterilizerRecord;
   update LowTempForJohnsonStageDetails set lowTempForJohnsonRecord_id=lowTempForJohnsonSterilizerRecord_id;
   -- 删除旧字段
   alter table LowTempForJohnsonStageDetails drop column lowTempForJohnsonSterilizerRecord_id;
   -- 删除旧表
   drop table LowTempForJohnsonSterilizerRecord;
END;
ELSE
BEGIN
   -- 表数据迁移到新表
   select cycleCounter,endDate,machineNumber,programName,stageTotalMin,stageTotalSec,startDate,SterilizationRecordId,totalCycleCounter into LowTempForJohnsonRecord from LowTempForJohnsonSterilizerRecord;
   update LowTempForJohnsonStageDetails set lowTempForJohnsonRecord_id=lowTempForJohnsonSterilizerRecord_id;
   -- 删除旧字段
   alter table LowTempForJohnsonStageDetails drop column lowTempForJohnsonSterilizerRecord_id;
   -- 删除旧表
   drop table LowTempForJohnsonSterilizerRecord;
END;
END;