Master Summoner
- Joined
- Nov 9, 2009
- Messages
- 579
- Reaction score
- 238
With this sql query you will be able to get the Location (Inventory, Storage, Pet), CharID, JID and ItemCode of an item with the serial that was specified.
Can come very handy if used inside a php script which gets input out of a html form textarea where you specify 1 Serial at a time and then use this query inside a loopto recieve all those infos on multiple items very easily and fast!
sorted into a table it may even look good. i wrote this query to ease the work when someone was scammed or his account was "hacked" ^^
Compatible with MSSQL 2005/2008 (didnt test 2012)
greetz
Can come very handy if used inside a php script which gets input out of a html form textarea where you specify 1 Serial at a time and then use this query inside a loopto recieve all those infos on multiple items very easily and fast!
sorted into a table it may even look good. i wrote this query to ease the work when someone was scammed or his account was "hacked" ^^
Compatible with MSSQL 2005/2008 (didnt test 2012)
Code:
USE SRO_VT_ACCOUNT
DECLARE @Serial bigint
declare @CID int
declare @AID int
declare @ItemCode varchar(50)
declare @loc varchar(50)
set @loc = 'inventory'
---------------------------------------------------
SET @Serial = YOUR_SERIAL_HERE
---------------------------------------------------
SET @CID = (select CharID from SRO_VT_SHARD.dbo._Inventory where ItemID = (select ID64 from SRO_VT_SHARD.dbo._Items where Serial64 like @Serial))
if @CID is null
begin
SET @AID = (select UserJID from SRO_VT_SHARD.dbo._Chest where ItemID = (select ID64 from SRO_VT_SHARD.dbo._Items where Serial64 like @Serial))
SET @loc = 'chest'
end
else if @AID is null
begin
SET @AID = (select UserJID from SRO_VT_SHARD.dbo._User where CharID = (select OwnerCharID from SRO_VT_SHARD.dbo._CharCOS where ID = (select COSID from SRO_VT_SHARD.dbo._InvCOS where ItemID = (select ID64 from SRO_VT_SHARD.dbo._Items where Serial64 like @Serial))))
SET @loc = 'pet'
end
else
begin
SET @AID = (select UserJID from SRO_VT_SHARD.dbo._User where CharID = @CID)
end
SET @ItemCode = (select CodeName128 from SRO_VT_SHARD.dbo._RefObjCommon where ID = (select RefItemID from SRO_VT_SHARD.dbo._Items where Serial64 like @Serial))
SELECT top 1 tbuser.StrUserID as AccID, chart.CharName16 as CharName, @Serial as Serial, @ItemCode as ItemCode, @loc as Location
FROM TB_User as tbuser
JOIN SRO_VT_SHARD.dbo._AccountJID as accjid on tbuser.JID = accjid.JID
JOIN SRO_VT_SHARD.dbo._User as usert on accjid.JID = usert.UserJID
JOIN SRO_VT_SHARD.dbo._Char as chart on usert.CharID = chart.CharID
WHERE usert.UserJID = @AID
greetz
Last edited: