Print 'Doing pre run Checks to ensure script not already run'; Select * from Script_History where Script_Name='ReleaseNov2023Week1'; if @@ROWCOUNT!=0 BEGIN RAISERROR('THIS SCRIPT HAS ALREADY BEEN RUN ON THIS SERVER, CANNOT CONTINUE, PLEASE CONTACT DEV',11,1); RETURN; END GO IF (SELECT COUNT(0) FROM SystemSetting WHERE SettingKey = 'HideDeleteBuyButton') = 0 INSERT INTO SystemSetting(SettingKey, SettingCategoryId, SettingValueBit, TypeFlag) VALUES('HideDeleteBuyButton', 1, 0, 4) GO IF (SELECT Default_Value FROM System_Default WHERE Default_Name = 'ISJV') = 1 UPDATE SystemSetting SET SettingValueBit = 1 WHERE SettingKey = 'HideDeleteBuyButton' GO Print 'Insert into script history if everything else is cool'; Insert into Script_History (RunDate,Script_Name) Values (CURRENT_TIMESTAMP,'ReleaseNov2023Week1'); IF @@ERROR != 0 BEGIN RAISERROR ('UNABLE TO CONTINUE WITH SCRIPT', 11, 1); RETURN; END GO