|
Helo i have a probleme here from the table Character >PCPointsi have players that paly o this game and win PCPoints letz say 100 and i want to make a php or a SQL JOB , this PCPoints in Tabel MEMB_INFO > cspoints but after replace them and te same time to add them Example before conversion **
** and after i want to have **
** the formula will be a+b = c and a = 0 where A= PCpoints and b=cspoints and c=a+b
have try to make this code via the book but is not working i mess up i have made a progres but the PCPoints did not delete after conversion
is verry immportant after the conversion the player have 0 PCPoints , because i dont want them to update the cspoints forever please help
(comments are locked)
|
|
First of all, please help us to help you better by posting the DDLs of the tables, some test data and the desired output. Now, If I understand correctly, what you want is to add character points to the member and then re-initialize the character points after the addition. One way of doing it is to get the updated Members into a Declared table by using OUTPUT clause and then using the same info to re-initialize the character points with zero but in a Transaction mode. Something like DDL code now found in comments under Question.
Jun 12 '12 at 08:45 AM
Fatherjack ♦♦
If you will give me the honor to honor you with a beer , please send me your paypall acount i dont have much , i dont know much , but this will be my last wish of this topic THANK YOU and i wait your paypall acount
Jun 15 '12 at 02:04 AM
zohan
@zohan We are here to help and get help voluntarily. This is why I love this forum. Thanks for the kindness, but we would be happy if you mark the answer as accepted. Cheers.
Jun 15 '12 at 05:11 AM
Usman Butt
i have tested on the acounts , and wen i put 1000 PCPoints to my acount i run the script the PCPoints go to 0 , but on the cspoints is 0 to I have tested with data on cspoints and realise that on colum cspoints dont arive anything because i have put 500 cspoints and after i run again the simulation the pcpoints was 0 and cspoints 500 no change only on the pcpoints So wat happens is that the pcpoints get to 0 and the cspoints dont get any data from the pcpoints colums .. I have try to copy the right colums but still no progres wat cood be a problem Still i did not click execute and click the for use maby this video will help Video link
Jul 07 '12 at 09:07 AM
zohan
(comments are locked)
|
|
The sript is perfect it works first time but later in the procces give some erros and do not Upload the results in the cspoints from MEMB_INFO My ideea was that the users from Table Character do not have only one Character so the bug apears wen the same account has multply character with pcpoints and do not add up So first i shood ADD all the PCPoints of the SAME account , so wat i need is to add first the PCPoints from the Character table with the same AccountID then The result add with cspoints from MEMB_INFO .... I think this solution will fix my problem .. can anny one help me with the code here .. and merry cirstmas to all here
(comments are locked)
|
|
The sript is perfect it works first time but later in the procces give some erros and do not Upload the results in the cspoints from MEMB_INFO My ideea was that the users from Table Character do not have only one Character so the bug apears wen the same account has multply character with pcpoints and do not add up So first i shood ADD all the PCPoints of the SAME account , so wat i need is to add first the PCPoints from the Character table with the same AccountID then The result add with cspoints from MEMB_INFO .... I think this solution will fix my problem .. can anny one help me with the code here .. and merry cirstmas to all here
(comments are locked)
|
|
i dot know for wat reason the main code is not working dose not show any error , but is not compelte the transaction to add the cspoints and it deletes the PcPoints at the end fist time wen i used it work fine but after i iserted in the SQL > JOB , to execute the code each wekend , the code fail to do this for 2 weeks in a row , and wen i try to use it again just write Query compelte no errors but he did not achive the main subject .... usman ? are you there ? code is here https://www.dropbox.com/s/p8oipr87j5ukflp/errorlogs.txt And copy here but will coppy without some lines _ @zohan Sorry for the delay but I was too busy at work. If it is not giving any error then there is no syntax error. But there could be some logical errors like the JOIN columns do not have the same data or no data at all. That I guess can only be identified by yourself.
Jul 05 '12 at 06:06 AM
Usman Butt
i have tested on the acounts , and wen i put 1000 PCPoints to my acount i run the script the PCPoints go to 0 , but on the cspoints is 0 to I have tested with data on cspoints and realise that on colum cspoints dont arive anything because i have put 500 cspoints and after i run again the simulation the pcpoints was 0 and cspoints 500 no change only on the pcpoints So wat happens is that the pcpoints get to 0 and the cspoints dont get any data from the pcpoints colums .. I have try to copy the right colums but still no progres wat cood be a problem Still i did not click execute and click the for use maby this video will help Video link
Jul 07 '12 at 09:07 AM
zohan
Anyone know wat is the pproblem here ? i have try like crazy did not work why?
Jul 12 '12 at 11:19 PM
zohan
@zohan Can you please post some data from both the tables? Then it would be easier for me to understand the problem.
Jul 13 '12 at 05:41 AM
Usman Butt
i have post the tables dll theere wat data do you need , ? Thid you see the video Link
Jul 15 '12 at 06:16 PM
zohan
(comments are locked)
|
|
So this is all the data i have it here , from the 2 tables , wat data do you need from them
(comments are locked)
|
1 2 next page »
Character
MEMB_INFO


so i try to modify where i did know is wrong can you make more clear the problem
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 )
I have edited my answer and shown a complete example with a dummy data. It is working fine. If you still have some problem, then post the error or the anomaly you are facing.
So the Character Table is the one with PCPoints and the MEMB_INFO Table is the one with cspoints
wat i want is to Add PCPoints to cspoints and delete the PCPoints after
so is like this if in the PCPoints is 10 and in the cspoints is 20
after use of the code in the PCPoints will be 0 and in the cspoins will be 30 Note that in Character the colum cspoints is usless and i dont use it
@zohan This is exactly what is done in the example. So I did not understand what else you want? What is meant by
And then later
Do you mean that only the MEMBINFO table's columns are used and there is no need to use CHARACTER table?
noo no
Character table has a colum cspoints but i use for somting else
wat i need is to move and add data from Table Character colum PCPoints in to table MEMB_INFO colum cspoints and after this delete the PCPoints info or set 0