Query add points

Results 1 to 6 of 6
  1. #1
    Apprentice Kimsangchul is offline
    MemberRank
    Jun 2010 Join Date
    20Posts

    Query add points

    Msg 2627, Level 14, State 1, Procedure hb_py_gp_apply_userinfo_in, Line 311
    Violation of PRIMARY KEY constraint 'PK_TAccountMst'. Cannot insert duplicate key in object 'dbo.TACCOUNTMST'.
    The statement has been terminated.

    (1 row(s) affected)


    This happens because


  2. #2
    Account Upgraded | Title Enabled! mrNickname is offline
    MemberRank
    May 2005 Join Date
    Isolated TowerLocation
    270Posts

    Re: Query add points

    Created accounts must login to the game atleast one time to make the procedures work. Try login and logout and execute the procedure, see if that works.

  3. #3
    Deny everything. Tsukasa is offline
    MemberRank
    Jun 2005 Join Date
    Net SlumLocation
    558Posts

    Re: Query add points

    Don't create multiple rows for the same user, increase or decrease the amount of cookies in a user's row instead.

  4. #4
    Novice blackstep is offline
    MemberRank
    Sep 2009 Join Date
    1Posts

    how to add cookies please

    Tsukaya, but I do output like this

    http://image.ohozaa.com/i/db4/2untitled.jpg

    Help me please

  5. #5
    Deny everything. Tsukasa is offline
    MemberRank
    Jun 2005 Join Date
    Net SlumLocation
    558Posts

    Re: Query add points

    Again, if you execute hb_py_gp_apply_userinfo_in the way it is described here and you haven't tinkered with the database manually it should be working fine.

    If the execution fails but the user has a row in TAccountMst already, you can also use this simple update query:

    Code:
    USE [INI3Bill_DB]
    GO
    
    DECLARE	@cookiesToAdd int
    DECLARE	@totalCookies int
    
    DECLARE @accountName varchar(32)
    
    SET @accountName = N'tsukasa'
    SET @cookiesToAdd = 100000
    
    -- Get the old amount (we could do this in one step during update, but oh well)
    SELECT TOP 1 @totalCookies = CookieAmt FROM TAccountMst
    WHERE UserID = @accountName
    
    -- Increase the value by the amount we want
    SET @totalCookies = @totalCookies + @cookiesToAdd
    
    -- And update the amount of cookies for the account
    UPDATE TAccountMst
    SET CookieAmt = @totalCookies
    WHERE UserID = @accountName
    
    GO

  6. #6
    Proficient Member bubbastic is offline
    MemberRank
    Nov 2010 Join Date
    WindHillLocation
    181Posts

    Re: Query add points

    simple and effective:) as always XD

    Btw lol at your new avatar ^
    Last edited by bubbastic; 12-01-11 at 01:59 PM.



Advertisement