Sql Query Error

Results 1 to 12 of 12
  1. #1
    Valued Member knotforseil is offline
    MemberRank
    Feb 2012 Join Date
    103Posts

    Sql Query Error

    Im trying to run this query
    Code:
    CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
     @memb___id varchar(10)
     AS
    Begin    
    set nocount on
        Declare  @Find_id varchar(10)    
        Declare @Connectstat tinyint
    	declare @OnLineHours real
    	declare @Credits int
        Set @Connectstat = 0     
        Set @Find_id = 'NOT'
        select @Find_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( @Find_id <> 'NOT' )    
        begin        
    	SELECT @Credits= credits FROM MEMB_INFO where memb___id = 'account'
            update MEMB_STAT set ConnectStat = @Connectstat, DisConnectTM = getdate(), OnlineHours = @Credits/10+(DATEDIFF(hh,ConnectTM,getdate()))
             where memb___id = 'account'
    	SELECT  @OnLineHours =OnlineHours FROM MEMB_STAT WHERE memb___id = 'account'
    
    	UPDATE [dbo].[MEMB_INFO]
    	SET credits= @OnLineHours * 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.


  2. #2
    Valued Member knotforseil is offline
    MemberRank
    Feb 2012 Join Date
    103Posts

    Re: Sql Query Error

    help please.

  3. #3
    Hmm.. huh? MrQU3ST10N is offline
    MemberRank
    Jun 2013 Join Date
    Trojan St. 404Location
    1,109Posts

    Re: Sql Query Error

    for what is that query? xD
    I know a little about executing queries but just a
    quick question for what is that query you put in ?

  4. #4
    Alpha Member 2009x2014 is offline
    MemberRank
    Dec 2009 Join Date
    2,765Posts

    Re: Sql Query Error

    Invalid column name 'credits' is the answer.

    Simply replace all "credits" in your query with correct column name.

  5. #5
    Valued Member knotforseil is offline
    MemberRank
    Feb 2012 Join Date
    103Posts

    Re: Sql Query Error

    @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.

  6. #6
    Hmm.. huh? MrQU3ST10N is offline
    MemberRank
    Jun 2013 Join Date
    Trojan St. 404Location
    1,109Posts

    Re: Sql Query Error

    here :

    I got some link ,
    I hope you will understand this queries >.< ..

    LINK 1

    LINK 2

    Good luck
    Last edited by MrQU3ST10N; 24-04-14 at 06:38 PM.

  7. #7
    Alpha Member 2009x2014 is offline
    MemberRank
    Dec 2009 Join Date
    2,765Posts

    Re: Sql Query Error

    Quote Originally Posted by knotforseil View Post
    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

  8. #8
    Valued Member knotforseil is offline
    MemberRank
    Feb 2012 Join Date
    103Posts

    Re: Sql Query Error

    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]   @memb___id varchar(10)
    AS
    Begin
    set nocount on
    Declare   @Find_id varchar(10)
    Declare   @Connectstat tinyint
    declare   @OnLineHours real
    declare   @Credits int
    Set   @Connectstat = 0
    Set   @Find_id = 'NOT'
    select   @Find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_CREDITS I ON S.memb___id = I.memb___id
    where I.memb___id =   @memb___id
    if(   @Find_id <> 'NOT' )
    begin
    SELECT   @Credits= credits FROM MEMB_CREDITS where memb___id =   @memb___id
    update MEMB_STAT set ConnectStat =   @Connectstat, DisConnectTM = getdate(), OnlineHours =   @Credits/10+(DATEDIFF(hh,ConnectTM,getdate()))
    where memb___id =   @memb___id
    SELECT   @OnLineHours =OnlineHours FROM MEMB_STAT WHERE memb___id =   @memb___id
    
    UPDATE [dbo].[MEMB_CREDITS]
    SET   @Credits=credits +    @OnLineHours * 10)
    WHERE memb___id =   @memb___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.

  9. #9
    Hmm.. huh? MrQU3ST10N is offline
    MemberRank
    Jun 2013 Join Date
    Trojan St. 404Location
    1,109Posts

    Re: Sql Query Error

    here's another link

    LINK 1

    ----
    or just take a Module for that? for MuCore? xD

  10. #10
    Valued Member knotforseil is offline
    MemberRank
    Feb 2012 Join Date
    103Posts

    Re: Sql Query Error

    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...

  11. #11
    Alpha Member 2009x2014 is offline
    MemberRank
    Dec 2009 Join Date
    2,765Posts

    Re: Sql Query Error

    Quote Originally Posted by knotforseil View Post

    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

  12. #12
    Valued Member knotforseil is offline
    MemberRank
    Feb 2012 Join Date
    103Posts

    Re: Sql Query Error

    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.



Advertisement