 - set ANSI_NULLS ON
- set QUOTED_IDENTIFIER ON
- go
- CREATE PROCEDURE [dbo].[decode_all_items_inn_1299]
- --By cherry killingzones.com
- AS
- declare @StrAccountID char(21)
- DECLARE Backup_Cursor CURSOR
- FOR
- SELECT straccountID from warehouse
- OPEN Backup_Cursor
- FETCH NEXT FROM Backup_Cursor INTO @StrAccountID
- WHILE @@FETCH_STATUS = 0
- BEGIN
- DECLARE @row int, @i int, @count int, @dwid int, @type varbinary(4), @StackSize int, @strSerial int, @name char(50)
- SET @i = 1
- set @name = ''
- WHILE @i < 1601
- BEGIN
- SELECT @dwid = cast(cast(substring(cast(substring(WarehouseData, @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(WarehouseData, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(WarehouseData, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(WarehouseData, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int),
- @strSerial = cast(cast(substring(cast(substring(strSerial, @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(strSerial, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(strSerial, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(strSerial, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int),
- @type = cast(substring(WarehouseData, @i+4, 2) as varbinary(2)),
- @StackSize = cast(cast(cast( substring(WarehouseData, @i+7, 1) as varbinary(1))+cast(substring(WarehouseData, @i+6, 1) as varbinary(1)) as varbinary(2)) as smallint)
- FROM WAREHOUSE
- WHERE StrAccountID = @StrAccountID
- select @name = strname from item where num = @dwid
- IF @dwid <> 0
- INSERT INTO ITEM_DECODED (straccountID, Name, dwid, strSerial, Durability, StackSize, ii)
- VALUES (@StrAccountId, @Name, @dwid, @strSerial, @type, @StackSize, (@i-1) / 8)
- SET @i = @i + 8
- END
- FETCH NEXT FROM Backup_Cursor INTO @StrAccountID
- END
- CLOSE Backup_Cursor
- DEALLOCATE Backup_Cursor
- exec wipe_decode_all_items_1299
复制代码- set ANSI_NULLS ON
- set QUOTED_IDENTIFIER ON
- go
- CREATE PROCEDURE [dbo].[wipe_decode_all_items_1299]
- --By cherry killingzones.com
- AS
- declare @straccountid char(21), @struserid char(21), @strSerial bigint, @dwid int, @stacksize smallint, @ii smallint
- DECLARE Backup_Cursor CURSOR
- FOR
- SELECT straccountid, struserid, strserial, dwid, stacksize, ii from item_decoded
- OPEN Backup_Cursor
- FETCH NEXT FROM Backup_Cursor INTO @straccountid, @struserid, @strSerial, @dwid, @stacksize, @ii
- WHILE @@FETCH_STATUS = 0
- BEGIN
- declare @count int
- SELECT @count = COUNT(*) FROM ITEM_DECODED WHERE strSerial = @strSerial and dwid = @dwid
- IF @count > 1 and @strSerial != 0 and @dwid !=0
- BEGIN
- INSERT INTO DUPERS_LOGGED (straccountid,struserid,dwid,strserial,ii)
- VALUES (@straccountid,@struserid,@dwid,@strSerial,@ii)
- END
- FETCH NEXT FROM Backup_Cursor INTO @straccountid, @struserid, @strSerial, @dwid, @stacksize, @ii
- END
- CLOSE Backup_Cursor
- DEALLOCATE Backup_Cursor
- exec encode_all_items_1299
复制代码 |