GO if (select count(0) from System_Default where Default_Name = 'Main_Store_ID' and Default_Value in (261, 7, 259, 192, 119, 8, 245, 132, 252 )) > 0 UPDATE SystemSetting SET SettingValueDecimal = '18' WHERE SettingKey = 'ProjectionPeriod' go Print 'If you see rows affected means it updated and ran script if you just see this message means nothing was updated'; GO if (select count(0) from System_Default where Default_Name = 'Main_Store_ID' and Default_Value in (261, 7, 259, 192, 119, 8, 245, 132, 252 )) > 0 UPDATE SystemSetting SET SettingValueBit = 0 WHERE SettingKey = 'ProjectionPeriodEnabled' --DONT ALLOW THE DAYS TO BE CHANGED go