Welcome to Sign in | Join | Help
in Search

SQL Querry ?

Last post 06-15-2012, 5:29 by zohan. 6 replies.
Sort Posts: Previous Next
  •  05-29-2012, 1:01 9258

    SQL Querry ?

    Salut prieteni , am si eu o problema mare , cu o dilema la mijloc

    Iata problema

    am un db (Data Base) SQL

    si tabelul Characters
    Coloana PCPoints
    (jucatori de pe server de la mine adauga pucte omorand mobi) sa zicem 100

    Si vreau sa convertesc via SQL JOB preferabil Php , aceste PCPoints in

    Tabelul MEMB_INFO
    Coloana cspoints


    Dar imediat ce conversia a fost facuta sa fie asa

    Inainte de conversie
    PCPoints = 100
    cspoints = 0

    Dupa conversie

    Pcpoints = 0
    cspoints =100


    iata cum arata Tabelele


    Character



    MEMB_INFO



    Pana acuma am venit cu formula ara


    Update MEMB_INFO
    Set cspoints = a.cspoints+b.PCPoints
    FROM Character iner JOIN MEMB_STAT ON Character.AccountID=MEMB_INFO.memb___id
    where a=cspoints and b=PCPoints


    din greseala am stricat codul acesta pe undeva , oricum stiu ca il facusem bine si imi dadea informatia din PCPoints dar nu o stergea ramanea si la PCPoints 100 si jucatori pot incarca cspointuri fara numar cine crede ca ma poate ajuta
  •  05-31-2012, 11:15 9263 in reply to 9258

    Re: SQL Querry ?

    helo cineva ma ajuta si pe mine :)
  •  06-01-2012, 10:21 9264 in reply to 9263

    Re: SQL Querry ?

    Hello
    Incepe cu
    http://www.sqlservercentral.com/stairway/75773/
  •  06-02-2012, 5:32 9265 in reply to 9264

    Re: SQL Querry ?

    bun deci cer ajutor si ma trimiti la carte :) super o sa intreb pe acolo vad ca e comunitate
  •  06-03-2012, 10:18 9268 in reply to 9265

    Re: SQL Querry ?

    daca tu crezi despre ajutor ca inseamna ca sa vezi codul tau scris de altcineva... te inseli.

    Ignat Andrei
    http://serviciipeweb.ro/iafblog
  •  06-10-2012, 10:32 9272 in reply to 9268

    Re: SQL Querry ?

    SET XACT_ABORT ON;

    BEGIN TRY

    BEGIN TRAN

    DECLARE @Members TABLE ( memb_id VARCHAR(10) )

    UPDATE MEMB_INFO
    SET cspoints = a.cspoints + b.PCPoints
    OUTPUT DELETED.memb_id
    INTO @Members
    FROM [CHARACTER] b
    INNER JOIN [MEMBINFO] a
    ON b.AccountID = a.memb_id

    UPDATE [CHARACTER]
    SET PCPoints = 0
    WHERE AccountID IN ( SELECT memb_id
    FROM [@Members] AS M )

    .............................
    Do the COMMIT, CATCH EXCEPTION, ROLLBACK etc


    nu stiu sa il citesc multumesc admin , ma insel amarnic , macar cand pun o intrebare vin cu raspunsurile pe forumurile unde am pus intrebarea ca alcineva care e la fel de incepator ca mine daca da search sa aiba si raspunsul

    Decat sa dau astfel de raspunsuri care nu ma ajuta deloc mai bine lasam postu fara vizite
  •  06-15-2012, 5:29 9276 in reply to 9272

    Re: SQL Querry ?

    Okey prieteni am rezolvat puteti inchide acest post

    iata rezolvarea

    Multumesc celor de la SQL ASK si lui Usman Butt


    SET XACT_ABORT, NOCOUNT ON;

    BEGIN TRY

    BEGIN TRAN

    DECLARE @Members TABLE (memb___id VARCHAR(10))


    UPDATE MEMB_INFO
    SET cspoints = a.cspoints + b.PCPoints
    OUTPUT INSERTED.memb___id
    INTO @Members
    FROM [Character] b
    INNER JOIN [MEMB_INFO] a
    ON b.AccountID = a.memb___id

    UPDATE [Character]
    SET PCPoints = 0
    WHERE AccountID IN ( SELECT memb___id
    FROM @Members AS M )


    IF @@TRANCOUNT > 0
    COMMIT TRAN
    END TRY
    BEGIN CATCH

    SELECT ERROR_MESSAGE(), ERROR_LINE()
    IF @@TRANCOUNT > 0 AND XACT_STATE () <> 0
    ROLLBACK TRAN

    END CATCH
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems