well i had the need to find a certain item on my players inventories/warehouses. this brought me the need to find/develop a sql query to find me everyone with that item.
i searched ragezone forums and didnt actualy find what i was looking for, i found only the first step, after that with the few sql knowledge i have, i edited it a bit and made it work with some help from Chumpy
the code for the item you want to look for is in this example a Map Part - 4202 , the code is in reversed hex code.
this is the original query that should work
in case this does not work, like it happened to me, you can try and do what i also did, which fixed it for me.Code:select C.characteridx, C.Name from cabal_Inventory_table I with(nolock) inner join cabal_character_table C with(nolock) on I.characteridx = C.characteridx where master.dbo.fn_varbintohexstr (I.data) like '%4202%'
go to your Enterprise Manager and go to the GAMEDB - User Defined Functions
create a new one with this code
after you have done this this is the query you have to use to look for the item on the players inventoryCode:-- System UDF fn_test -- This function takes as input a varbinary -- and returns the Hexadecimal representation string -- CREATE function dbo.fn_test ( @pbinin varbinary(8000) ) returns nvarchar(4000) as begin declare @pstrout nvarchar(4000) select @pstrout = master.dbo.fn_varbintohexsubstring(1,@pbinin,1,0) return @pstrout end
you can also use this following query to look for the item in the players warehouseCode:select C.characteridx, C.Name from cabal_Inventory_table I with(nolock) inner join cabal_character_table C with(nolock) on I.characteridx = C.characteridx where GAMEDB.dbo.fn_test (I.data) like '%4202%'
Code:select A.usernum, A.ID from cabal_warehouse_table W with(nolock) inner join account.dbo.cabal_auth_table A with(nolock) on W.usernum = A.usernum where GAMEDB.dbo.fn_test (W.data) like '%4202%'
i have only tested the warehouse query with the edited function on the GAMEDB. so feel free to try it without adding the function to the GAMEDB if you want.
i hope it prooves as usefull for you as it did for me.
if you liked this post please press the thanks button :)


Reply With Quote


