's query about cleaning inventory, this one is to see inventory and storage items :)
Code:
USE [SRO_VT_SHARD]
GO
SET NOCOUNT ON;
/*
* Check items in inventory and storage
* Witchy Moo 20150622
*/
DECLARE @CharName VARCHAR(64)
DECLARE @CharID INT
DECLARE @userJID INT
DECLARE @ItemID BIGINT
DECLARE @CharSlot TINYINT
DECLARE @codename128 VARCHAR(64)
SET @CharName = 'Witchy' -- set character name here
/* Check items in inventory */
PRINT CHAR(10)+'Inventory Items:'
SELECT @CharID = CharID FROM [_Char] WHERE CharName16 = LTRIM(RTRIM(@CharName))
DECLARE cur CURSOR FOR SELECT ItemID, Slot FROM [_Inventory] WITH (NOLOCK) WHERE CharID = @CharID AND ItemID > 0 ORDER BY Slot ASC
OPEN cur
FETCH NEXT FROM cur INTO @ItemID, @CharSlot
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @codename128 = CodeName128 FROM [_RefObjCommon] WITH (NOLOCK) WHERE ID = (SELECT RefItemID FROM [_Items] WITH (NOLOCK) WHERE ID64 = @ItemID)
PRINT '- Inventory slot ' + CAST(@CharSlot AS VARCHAR) + ': ' + @codename128
FETCH NEXT FROM cur INTO @ItemID, @CharSlot
END;
CLOSE cur
DEALLOCATE cur
/* Check items in storage */
PRINT CHAR(10)+'Storage Items:'
SELECT @userJID = UserJID FROM _User WHERE CharID = @CharID
DECLARE cur CURSOR FOR SELECT ItemID, Slot FROM [_Chest] WITH (NOLOCK) WHERE UserJID = @userJID AND (ItemID <> 0 AND ItemID IS NOT NULL) ORDER BY Slot ASC
OPEN cur
FETCH NEXT FROM cur INTO @ItemID, @CharSlot
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @codename128 = CodeName128 FROM [_RefObjCommon] WITH (NOLOCK) WHERE ID = (SELECT RefItemID FROM [_Items] WITH (NOLOCK) WHERE ID64 = @ItemID)
PRINT '- Storage Slot ' + CAST(@CharSlot AS VARCHAR) + ': ' + @codename128
FETCH NEXT FROM cur INTO @ItemID, @CharSlot
END;
CLOSE cur
DEALLOCATE cur