This is a T-SQL script to fill GM warehouse with BOK+5 with unique serials.
HOW: Add an SQL Agent Job and paste this code there. Don't forget to adjust the schedule to your liking. Not much to say.![]()
If you can enhance it and feel like posting an update please do.
If you have no SQL Server Agent, you can still use this code and save it as Stored Procedure then call this code via Task Scheduler in Windows using a php script.Code:DECLARE @gm varchar(255), @pos int, @gmID varchar(255), @i int, @bok nvarchar(4000), @UpdateGMVault nvarchar(4000) SET @gm = 'nukerz,blasters,duperz,hackerz,scammers' SET @pos = 0 if right(rtrim(@gm),1) <> ',' set @gm = @gm + ',' set @pos = patindex('%,%' , @gm) while @pos <> 0 begin set @gmID = left(@gm, @pos-1) SET @bok = '0x' SET @i = 1 while (@i < 121 ) BEGIN -- BOK + 5 (box of luck +12) SET @bok = @bok + 'CB6000' + LEFT(newid(),8) + '800000' SET @i = @i + 1 END SET @UpdateGMVault = 'update warehouse set items = ' + @bok + ' where AccountID = ''' + @gmID + '''' EXEC(@UpdateGMVault) set @gm = stuff(@gm, 1, @pos, '') set @pos = patindex('%,%' , @gm) end
I hope it will help a lot.![]()


Reply With Quote

