Print 'Doing pre run Checks to ensure script not already run'; Select * from Script_History where Script_Name='HRUpdate20250722'; if @@ROWCOUNT!=0 BEGIN RAISERROR('THIS SCRIPT HAS ALREADY BEEN RUN ON THIS SERVER, CANNOT CONTINUE, PLEASE CONTACT DEV',11,1); RETURN; END GO declare @StoreId int; set @StoreId = (select default_value from system_default where Default_Name = 'Main_store_id'); If(@StoreId in (299, 256, 291, 180, 304, 211, 237, 236, 264, 279, 313, 269, 257, 141, 89, 194, 270, 60, 126, 230, 260, 288, 285, 137, 55, 249, 212, 103, 213, 57, 159, 226, 110, 247, 206, 66, 223, 73, 47, 162, 81, 312, 217, 140, 281, 292, 198, 207, 112, 154, 64, 233, 163, 52, 283, 42, 39, 45, 287, 201, 266, 98, 255, 6, 108, 63, 251, 286, 262, 28, 241, 261, 272, 232, 218, 91, 176, 259, 49, 309, 26, 276, 130, 224, 144, 235, 258, 99, 96 )) begin update [system_user] set locked = 0 where system_user_id =70220 and @StoreId=299; update [system_user] set locked = 0 where system_user_id =143 and @StoreId=256; update [system_user] set locked = 0 where system_user_id =70211 and @StoreId=291; update [system_user] set locked = 0 where system_user_id =330 and @StoreId=180; update [system_user] set locked = 0 where system_user_id =70242 and @StoreId=304; update [system_user] set locked = 0 where system_user_id =140352 and @StoreId=211; update [system_user] set locked = 0 where system_user_id =223 and @StoreId=237; update [system_user] set locked = 0 where system_user_id =10285 and @StoreId=236; update [system_user] set locked = 0 where system_user_id =266 and @StoreId=264; update [system_user] set locked = 0 where system_user_id =203 and @StoreId=279; update [system_user] set locked = 0 where system_user_id =90292 and @StoreId=313; update [system_user] set locked = 0 where system_user_id =202 and @StoreId=269; update [system_user] set locked = 0 where system_user_id =40333 and @StoreId=257; update [system_user] set locked = 0 where system_user_id =459073 and @StoreId=141; update [system_user] set locked = 0 where system_user_id =499159 and @StoreId=89; update [system_user] set locked = 0 where system_user_id =10336 and @StoreId=194; update [system_user] set locked = 0 where system_user_id =271 and @StoreId=270; update [system_user] set locked = 0 where system_user_id =539098 and @StoreId=60; update [system_user] set locked = 0 where system_user_id =519632 and @StoreId=126; update [system_user] set locked = 0 where system_user_id =40290 and @StoreId=230; update [system_user] set locked = 0 where system_user_id =40325 and @StoreId=260; update [system_user] set locked = 0 where system_user_id =50293 and @StoreId=288; update [system_user] set locked = 0 where system_user_id =250 and @StoreId=285; update [system_user] set locked = 0 where system_user_id =530592 and @StoreId=126; update [system_user] set locked = 0 where system_user_id =459030 and @StoreId=137; update [system_user] set locked = 0 where system_user_id =458806 and @StoreId=55; update [system_user] set locked = 0 where system_user_id =110 and @StoreId=249; update [system_user] set locked = 0 where system_user_id =23 and @StoreId=212; update [system_user] set locked = 0 where system_user_id =40199 and @StoreId=288; update [system_user] set locked = 0 where system_user_id =458972 and @StoreId=103; update [system_user] set locked = 0 where system_user_id =76 and @StoreId=213; update [system_user] set locked = 0 where system_user_id =458810 and @StoreId=57; update [system_user] set locked = 0 where system_user_id =14 and @StoreId=213; update [system_user] set locked = 0 where system_user_id =458846 and @StoreId=159; update [system_user] set locked = 0 where system_user_id =92 and @StoreId=226; update [system_user] set locked = 0 where system_user_id =96 and @StoreId=213; update [system_user] set locked = 0 where system_user_id =589993 and @StoreId=110; update [system_user] set locked = 0 where system_user_id =115 and @StoreId=247; update [system_user] set locked = 0 where system_user_id =173 and @StoreId=206; update [system_user] set locked = 0 where system_user_id =458966 and @StoreId=66; update [system_user] set locked = 0 where system_user_id =134 and @StoreId=223; update [system_user] set locked = 0 where system_user_id =277 and @StoreId=206; update [system_user] set locked = 0 where system_user_id =458860 and @StoreId=73; update [system_user] set locked = 0 where system_user_id =237 and @StoreId=47; update [system_user] set locked = 0 where system_user_id =255 and @StoreId=236; update [system_user] set locked = 0 where system_user_id =469033 and @StoreId=162; update [system_user] set locked = 0 where system_user_id =458975 and @StoreId=81; update [system_user] set locked = 0 where system_user_id =80247 and @StoreId=312; update [system_user] set locked = 0 where system_user_id =252 and @StoreId=206; update [system_user] set locked = 0 where system_user_id =180 and @StoreId=217; update [system_user] set locked = 0 where system_user_id =459062 and @StoreId=140; update [system_user] set locked = 0 where system_user_id =158 and @StoreId=281; update [system_user] set locked = 0 where system_user_id =80212 and @StoreId=292; update [system_user] set locked = 0 where system_user_id =167 and @StoreId=281; update [system_user] set locked = 0 where system_user_id =227 and @StoreId=198; update [system_user] set locked = 0 where system_user_id =70219 and @StoreId=213; update [system_user] set locked = 0 where system_user_id =301 and @StoreId=207; update [system_user] set locked = 0 where system_user_id =499111 and @StoreId=112; update [system_user] set locked = 0 where system_user_id =489078 and @StoreId=154; update [system_user] set locked = 0 where system_user_id =459082 and @StoreId=64; update [system_user] set locked = 0 where system_user_id =100 and @StoreId=233; update [system_user] set locked = 0 where system_user_id =20323 and @StoreId=233; update [system_user] set locked = 0 where system_user_id =70289 and @StoreId=47; update [system_user] set locked = 0 where system_user_id =458849 and @StoreId=60; update [system_user] set locked = 0 where system_user_id =489011 and @StoreId=163; update [system_user] set locked = 0 where system_user_id =110294 and @StoreId=47; update [system_user] set locked = 0 where system_user_id =479069 and @StoreId=52; update [system_user] set locked = 0 where system_user_id =10197 and @StoreId=283; update [system_user] set locked = 0 where system_user_id =81 and @StoreId=233; update [system_user] set locked = 0 where system_user_id =81 and @StoreId=213; update [system_user] set locked = 0 where system_user_id =459069 and @StoreId=42; update [system_user] set locked = 0 where system_user_id =458983 and @StoreId=154; update [system_user] set locked = 0 where system_user_id =197 and @StoreId=236; update [system_user] set locked = 0 where system_user_id =197 and @StoreId=260; update [system_user] set locked = 0 where system_user_id =459000 and @StoreId=39; update [system_user] set locked = 0 where system_user_id =82 and @StoreId=233; update [system_user] set locked = 0 where system_user_id =206 and @StoreId=285; update [system_user] set locked = 0 where system_user_id =489156 and @StoreId=45; update [system_user] set locked = 0 where system_user_id =10189 and @StoreId=287; update [system_user] set locked = 0 where system_user_id =529146 and @StoreId=57; update [system_user] set locked = 0 where system_user_id =459049 and @StoreId=89; update [system_user] set locked = 0 where system_user_id =469062 and @StoreId=81; update [system_user] set locked = 0 where system_user_id =469169 and @StoreId=201; update [system_user] set locked = 0 where system_user_id =20207 and @StoreId=266; update [system_user] set locked = 0 where system_user_id =140327 and @StoreId=211; update [system_user] set locked = 0 where system_user_id =20305 and @StoreId=256; update [system_user] set locked = 0 where system_user_id =469124 and @StoreId=98; update [system_user] set locked = 0 where system_user_id =76 and @StoreId=212; update [system_user] set locked = 0 where system_user_id =184 and @StoreId=255; update [system_user] set locked = 0 where system_user_id =479082 and @StoreId=159; update [system_user] set locked = 0 where system_user_id =10239 and @StoreId=194; update [system_user] set locked = 0 where system_user_id =458858 and @StoreId=6; update [system_user] set locked = 0 where system_user_id =290 and @StoreId=212; update [system_user] set locked = 0 where system_user_id =20254 and @StoreId=108; update [system_user] set locked = 0 where system_user_id =153 and @StoreId=269; update [system_user] set locked = 0 where system_user_id =196 and @StoreId=212; update [system_user] set locked = 0 where system_user_id =458981 and @StoreId=89; update [system_user] set locked = 0 where system_user_id =479114 and @StoreId=63; update [system_user] set locked = 0 where system_user_id =459079 and @StoreId=64; update [system_user] set locked = 0 where system_user_id =100283 and @StoreId=251; update [system_user] set locked = 0 where system_user_id =122 and @StoreId=233; update [system_user] set locked = 0 where system_user_id =220 and @StoreId=286; update [system_user] set locked = 0 where system_user_id =50548 and @StoreId=262; update [system_user] set locked = 0 where system_user_id =499132 and @StoreId=66; update [system_user] set locked = 0 where system_user_id =459152 and @StoreId=28; update [system_user] set locked = 0 where system_user_id =10188 and @StoreId=226; update [system_user] set locked = 0 where system_user_id =10219 and @StoreId=241; update [system_user] set locked = 0 where system_user_id =509124 and @StoreId=39; update [system_user] set locked = 0 where system_user_id =145 and @StoreId=261; update [system_user] set locked = 0 where system_user_id =157 and @StoreId=272; update [system_user] set locked = 0 where system_user_id =459072 and @StoreId=140; update [system_user] set locked = 0 where system_user_id =363 and @StoreId=180; update [system_user] set locked = 0 where system_user_id =155 and @StoreId=272; update [system_user] set locked = 0 where system_user_id =222 and @StoreId=180; update [system_user] set locked = 0 where system_user_id =74 and @StoreId=232; update [system_user] set locked = 0 where system_user_id =479097 and @StoreId=66; update [system_user] set locked = 0 where system_user_id =459011 and @StoreId=55; update [system_user] set locked = 0 where system_user_id =160306 and @StoreId=218; update [system_user] set locked = 0 where system_user_id =40308 and @StoreId=91; update [system_user] set locked = 0 where system_user_id =228 and @StoreId=269; update [system_user] set locked = 0 where system_user_id =458987 and @StoreId=154; update [system_user] set locked = 0 where system_user_id =351 and @StoreId=176; update [system_user] set locked = 0 where system_user_id =40231 and @StoreId=259; update [system_user] set locked = 0 where system_user_id =10217 and @StoreId=247; update [system_user] set locked = 0 where system_user_id =458965 and @StoreId=49; update [system_user] set locked = 0 where system_user_id =146 and @StoreId=212; update [system_user] set locked = 0 where system_user_id =119 and @StoreId=247; update [system_user] set locked = 0 where system_user_id =80211 and @StoreId=292; update [system_user] set locked = 0 where system_user_id =10249 and @StoreId=91; update [system_user] set locked = 0 where system_user_id =80237 and @StoreId=309; update [system_user] set locked = 0 where system_user_id =268 and @StoreId=237; update [system_user] set locked = 0 where system_user_id =459174 and @StoreId=28; update [system_user] set locked = 0 where system_user_id =479098 and @StoreId=66; update [system_user] set locked = 0 where system_user_id =459701 and @StoreId=26; update [system_user] set locked = 0 where system_user_id =50547 and @StoreId=276; update [system_user] set locked = 0 where system_user_id =469091 and @StoreId=141; update [system_user] set locked = 0 where system_user_id =459185 and @StoreId=130; update [system_user] set locked = 0 where system_user_id =246 and @StoreId=264; update [system_user] set locked = 0 where system_user_id =161 and @StoreId=283; update [system_user] set locked = 0 where system_user_id =142 and @StoreId=217; update [system_user] set locked = 0 where system_user_id =20274 and @StoreId=224; update [system_user] set locked = 0 where system_user_id =459021 and @StoreId=144; update [system_user] set locked = 0 where system_user_id =40287 and @StoreId=235; update [system_user] set locked = 0 where system_user_id =180 and @StoreId=258; update [system_user] set locked = 0 where system_user_id =489210 and @StoreId=99; update [system_user] set locked = 0 where system_user_id =458981 and @StoreId=98; update [system_user] set locked = 0 where system_user_id =458936 and @StoreId=137; update [system_user] set locked = 0 where system_user_id =458930 and @StoreId=49; update [system_user] set locked = 0 where system_user_id =10249 and @StoreId=286; update [system_user] set locked = 0 where system_user_id =253 and @StoreId=261; update [system_user] set locked = 0 where system_user_id =459131 and @StoreId=140; update [system_user] set locked = 0 where system_user_id =70208 and @StoreId=292; update [system_user] set locked = 0 where system_user_id =489096 and @StoreId=159; update [system_user] set locked = 0 where system_user_id =169 and @StoreId=270; update [system_user] set locked = 0 where system_user_id =80214 and @StoreId=292; update [system_user] set locked = 0 where system_user_id =489218 and @StoreId=99; update [system_user] set locked = 0 where system_user_id =28 and @StoreId=211; update [system_user] set locked = 0 where system_user_id =459354 and @StoreId=96; update [system_user] set locked = 0 where system_user_id =499103 and @StoreId=39; update [system_user] set locked = 0 where system_user_id =99 and @StoreId=211; end Print 'Insert into script history if everything else is cool'; Insert into Script_History (RunDate,Script_Name) Values (CURRENT_TIMESTAMP,'HRUpdate20250722'); IF @@ERROR != 0 BEGIN RAISERROR ('UNABLE TO CONTINUE WITH SCRIPT', 11, 1); RETURN; END GO