Print 'Doing pre run Checks to ensure script not already run'; Select * from Script_History where Script_Name='ReleaseMarch2025Week5'; 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 SageAccountDetail where AccountNumber = 'IBR03801')=0) begin insert into SageAccountDetail(AccountName,AccountNumber,AccountType,Vatable,Description) values('GoldCoinSales','IBR03801','BankTransaction',1,'Gold Coin Sales'); end; if((select count(0) from SageAccountDetail where AccountNumber = 'IBR04801')=0) begin insert into SageAccountDetail(AccountName,AccountNumber,AccountType,Vatable,Description) values('GoldCoinSalesReturns','IBR04801','BankTransaction',1,'Gold Coin Sales Returns'); end; Print 'Insert into script history if everything else is cool'; Insert into Script_History (RunDate,Script_Name) Values (CURRENT_TIMESTAMP,'ReleaseMarch2025Week5'); IF @@ERROR != 0 BEGIN RAISERROR ('UNABLE TO CONTINUE WITH SCRIPT', 11, 1); RETURN; END GO