Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Sql Query Error

Status
Not open for further replies.
Junior Spellweaver
Joined
Feb 12, 2012
Messages
102
Reaction score
6
Im trying to run this query
Code:
CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
 [USER=1333365783]mem[/USER]b___id varchar(10)
 AS
Begin    
set nocount on
    Declare  [USER=1333416677]Find[/USER]_id varchar(10)    
    Declare [USER=1333459481]Connects[/USER]tat tinyint
	declare [USER=27501]OnLine[/USER]Hours real
	declare [USER=1333377105]Credits[/USER] int
    Set [USER=1333459481]Connects[/USER]tat = 0     
    Set [USER=1333416677]Find[/USER]_id = 'NOT'
    select [USER=1333416677]Find[/USER]_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id 
           where I.memb___id = 'account'
    if( [USER=1333416677]Find[/USER]_id <> 'NOT' )    
    begin        
	SELECT [USER=1333377105]Credits[/USER]= credits FROM MEMB_INFO where memb___id = 'account'
        update MEMB_STAT set ConnectStat = [USER=1333459481]Connects[/USER]tat, DisConnectTM = getdate(), OnlineHours = [USER=1333377105]Credits[/USER]/10+(DATEDIFF(hh,ConnectTM,getdate()))
         where memb___id = 'account'
	SELECT  [USER=27501]OnLine[/USER]Hours =OnlineHours FROM MEMB_STAT WHERE memb___id = 'account'

	UPDATE [dbo].[MEMB_INFO]
	SET credits= [USER=27501]OnLine[/USER]Hours * 10)
	WHERE memb___id = 'account'

    end
end
GO

But im getting this error:

Code:
Msg 207, Level 16, State 1, Procedure WZ_DISCONNECT_MEMB, Line 16
Invalid column name 'credits'.
Msg 207, Level 16, State 1, Procedure WZ_DISCONNECT_MEMB, Line 22
Invalid column name 'credits'.

Im using SQL2008 R2 and TT Files and DB's. Please help.
 
Custom Title Activated
Loyal Member
Joined
Dec 5, 2009
Messages
2,657
Reaction score
1,178
Invalid column name 'credits' is the answer.

Simply replace all "credits" in your query with correct column name.
 
Upvote 0
Junior Spellweaver
Joined
Feb 12, 2012
Messages
102
Reaction score
6
@MrQU3ST10N: Its the query for OnlineHours = Credits.

@4FUNer: The problem is that i dont know what is the proper column name for credits. Cause im trying to add a query for OnlineHours = Credits. Please help.
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Dec 5, 2009
Messages
2,657
Reaction score
1,178
4FUNer[/B]: The problem is that i dont know what is the proper column name for credits. Cause im trying to add a query for OnlineHours = Credits. Please help.


It depends where you gonna use "credits"

MuOnline originally contain "cashop currency" called WCoin (i guess TT files store WCoin in MEMB_INFO)
or pcpoints which is another story.

unless you want to use "credits" for webshop
then you have to connect correct table/column so query will be working,
so if you decide to use exchange for "webshop" currency, simply edit table (MEMB_INFO) user column (memb___id) & credits column (credits)
with the one you'r going to use.

MuCore Webshop for example would be MEMB_CREDITS -> memb___id -> Credits
so it's enough to edit MEMB_INFO TO MEMB_CREDITS and shud be fine.

also idk if you did it specially, but i see small mistake in ur query, so... hope you know what ur doing :)

HF
 
Upvote 0
Junior Spellweaver
Joined
Feb 12, 2012
Messages
102
Reaction score
6
Thanks for the answers. But i saw your post that MrQU3ST10N posted, i tried to run this query from what i understand.

Code:
CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]   [USER=1333365783]mem[/USER]b___id varchar(10)
AS
Begin
set nocount on
Declare   [USER=1333416677]Find[/USER]_id varchar(10)
Declare   [USER=1333459481]Connects[/USER]tat tinyint
declare   [USER=27501]OnLine[/USER]Hours real
declare   [USER=1333377105]Credits[/USER] int
Set   [USER=1333459481]Connects[/USER]tat = 0
Set   [USER=1333416677]Find[/USER]_id = 'NOT'
select   [USER=1333416677]Find[/USER]_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_CREDITS I ON S.memb___id = I.memb___id
where I.memb___id =   [USER=1333365783]mem[/USER]b___id
if(   [USER=1333416677]Find[/USER]_id <> 'NOT' )
begin
SELECT   [USER=1333377105]Credits[/USER]= credits FROM MEMB_CREDITS where memb___id =   [USER=1333365783]mem[/USER]b___id
update MEMB_STAT set ConnectStat =   [USER=1333459481]Connects[/USER]tat, DisConnectTM = getdate(), OnlineHours =   [USER=1333377105]Credits[/USER]/10+(DATEDIFF(hh,ConnectTM,getdate()))
where memb___id =   [USER=1333365783]mem[/USER]b___id
SELECT   [USER=27501]OnLine[/USER]Hours =OnlineHours FROM MEMB_STAT WHERE memb___id =   [USER=1333365783]mem[/USER]b___id

UPDATE [dbo].[MEMB_CREDITS]
SET   [USER=1333377105]Credits[/USER]=credits +    [USER=27501]OnLine[/USER]Hours * 10)
WHERE memb___id =   [USER=1333365783]mem[/USER]b___id

end
end
GO

But it gives me this error. :*:

Code:
Msg 468, Level 16, State 9, Procedure WZ_DISCONNECT_MEMB, Line 12
Cannot resolve the collation conflict between "Modern_Spanish_CI_AS" and "Korean_Wansung_CS_AS" in the equal to operation.
 
Upvote 0
Junior Spellweaver
Joined
Feb 12, 2012
Messages
102
Reaction score
6
Thanks for the response MrQU3ST10N.., But the link that you've posted doesn't supply the proper steps for sql job query.. :*:

4FUNer please pm the proper query.. Please... :adore::adore::adore::adore::adore::adore:
 
Upvote 0
Custom Title Activated
Loyal Member
Joined
Dec 5, 2009
Messages
2,657
Reaction score
1,178
Code:
Msg 468, Level 16, State 9, Procedure WZ_DISCONNECT_MEMB, Line 12
Cannot resolve the collation conflict between "Modern_Spanish_CI_AS" and "Korean_Wansung_CS_AS" in the equal to operation.

It was enough to solve collation conflict, but you decided to stay with MrQ so okkkkkkkkkkkkkkkkkkkkkkkkkkkk

so i have tested it

->

Command(s) completed successfully.


for collocation, add
Code:
COLLATE DATABASE_DEFAULT

for the columns which causes conflict.

example where A COLLATE DATABASE_DEFAULT = B COLLATE DATABASE_DEFAULT


also create? is for example only or you delete each time? XD

enough to replace with
ALTER PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]

and maybe... declare after alter/create

memb___id varchar(10)

HF
 
Upvote 0
Junior Spellweaver
Joined
Feb 12, 2012
Messages
102
Reaction score
6
Thanks for the response Sir Martin... Should i run this

Code:
COLLATE DATABASE_DEFAULT

Or replace

Code:
ALTER PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]

Or should i add this after this line?

Code:
@memb___id varchar(10)

Hoping for your kind consideration Sir Martin. Thanks in advance.
 
Upvote 0
Status
Not open for further replies.
Back
Top