Print 'Doing pre run Checks to ensure script not already run'; Select * from Script_History where Script_Name='ReleaseFeb2025Week4'; 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 = 'VatExemptedCategories') = 0 BEGIN insert into SystemSetting (SettingKey,SettingCategoryId,SettingValueString,TypeFlag) values ('VatExemptedCategories',1,'3397,3399,3401,3403,4491,4495,4499,4503,4507,4511,4515,4519,4523',4) END GO Print 'Insert into script history if everything else is cool'; Insert into Script_History (RunDate,Script_Name) Values (CURRENT_TIMESTAMP,'ReleaseFeb2025Week4'); IF @@ERROR != 0 BEGIN RAISERROR ('UNABLE TO CONTINUE WITH SCRIPT', 11, 1); RETURN; END GO