question

zohan avatar image
zohan asked

SQL Comands please help me

Helo i have a probleme here from the table **Character** >**PCPoints**i 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 ** > PCPoints = 100 and cspoints = 5 ** and after i want to have ** > Pcpoints = 0 and cspoints =105 ** the formula will be a+b = c and a = 0 where A= PCpoints and b=cspoints and c=a+b ![alt text][1] Character ![alt text][2] MEMB_INFO ![alt text][3] 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 > Update MEMB_INFO Set cspoints = > a.cspoints+b.PCPoints FROM Character.b > iner JOIN MEMB_INFO.a ON > Character.AccountID=MEMB_INFO.memb___id > where a=cspoints and b=PCPoints is verry immportant after the conversion the player have 0 PCPoints , because i dont want them to update the cspoints forever please help [1]: http://iceimg.com/i/c4/29/0589949170.jpg [2]: http://iceimg.com/i/7a/73/0974ed69da.jpg [3]: http://iceimg.com/i/5c/f8/6d85fd47dd.jpg
sql-server-2005calculations
12 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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.
1 Like 1 ·
@zohan This is exactly what is done in the example. So I did not understand what else you want? What is meant by > 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 And then later > Note that in Character the colum cspoints is usless and i dont use it Do you mean that only the MEMBINFO table's columns are used and there is no need to use CHARACTER table?
1 Like 1 ·
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 ) .............................
0 Likes 0 ·
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 USE [MuOnline] GO /****** Object: Table [dbo].[Character] Script Date: 06/12/2012 01:32:46 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Character]( [AccountID] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [Name] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [cLevel] [int] NULL CONSTRAINT [DF_Character_cLevel] DEFAULT ((1)), [LevelUpPoint] [int] NULL CONSTRAINT [DF_Character_LevelUpPoint] DEFAULT ((0)), [Class] [tinyint] NULL, [Experience] [int] NULL CONSTRAINT [DF_Character_Experience] DEFAULT ((0)), [Strength] [smallint] NULL, [Dexterity] [smallint] NULL, [Vitality] [smallint] NULL, [Energy] [smallint] NULL, [Inventory] [varbinary](1728) NULL, [MagicList] [varbinary](180) NULL, [Money] [int] NULL CONSTRAINT [DF_Character_Money] DEFAULT ((0)), [Life] [real] NULL, [MaxLife] [real] NULL, [Mana] [real] NULL, [MaxMana] [real] NULL, [MapNumber] [smallint] NULL, [MapPosX] [smallint] NULL, [MapPosY] [smallint] NULL, [MapDir] [tinyint] NULL CONSTRAINT [DF_Character_MapDir] DEFAULT ((0)), [PkCount] [int] NULL CONSTRAINT [DF_Character_PkCount] DEFAULT ((0)), [PkLevel] [int] NULL CONSTRAINT [DF_Character_PkLevel] DEFAULT ((3)), [PkTime] [int] NULL CONSTRAINT [DF_Character_PkTime] DEFAULT ((0)), [MDate] [smalldatetime] NULL, [LDate] [smalldatetime] NULL, [CtlCode] [tinyint] NULL CONSTRAINT [DF_Character_CtlCode] DEFAULT ((0)), [DbVersion] [tinyint] NULL CONSTRAINT [DF__Character__DbVer__3A4CA8FD] DEFAULT ((0)), [Quest] [varbinary](50) NULL CONSTRAINT [DF__Character__Quest__40F9A68C] DEFAULT ((0)), [Leadership] [smallint] NULL CONSTRAINT [DF__Character__Leade__6FB49575] DEFAULT ((0)), [ChatLimitTime] [smallint] NULL CONSTRAINT [DF__Character__ChatL__70A8B9AE] DEFAULT ((0)), [FruitPoint] [int] NULL CONSTRAINT [DF__Character__Fruit__44CA3770] DEFAULT ((0)), [JHDX] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL, [JHtype] [tinyint] NULL, [cspoints] [int] NULL, [Grand_Resets] [int] NOT NULL CONSTRAINT [DF__Character__Grand__42E1EEFE] DEFAULT ((0)), [mu_id] [int] IDENTITY(1,1) NOT NULL, [Resets] [int] NOT NULL CONSTRAINT [DF__Character__Reset__43D61337] DEFAULT ((0)), [EDSPostCmd] [int] NOT NULL CONSTRAINT [DF_Character_EDSPostCmd] DEFAULT ((0)), [CirePkRank] [int] NOT NULL CONSTRAINT [DF_Character_CirePkRank] DEFAULT ((0)), [EDSPostBanTime] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_Character_EDSPostBanTime] DEFAULT ((0)), [Married] [tinyint] NOT NULL CONSTRAINT [DF_Character_Married] DEFAULT ((0)), [MarryName] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL, [GensRank] [smallint] NOT NULL CONSTRAINT [DF_Character_GensRank] DEFAULT ((0)), [GensContribution] [int] NOT NULL CONSTRAINT [DF_Character_GensContribution] DEFAULT ((0)), [GensType] [tinyint] NOT NULL CONSTRAINT [DF_Character_GensType] DEFAULT ((0)), [GensLastLeave] [int] NOT NULL CONSTRAINT [DF_Character_GensLastLeave] DEFAULT ((0)), [GensKnight] [tinyint] NOT NULL DEFAULT ((0)), [PCPoints] [int] NOT NULL DEFAULT ((0)), [TempPcPoints] [int] NOT NULL DEFAULT ((0)), CONSTRAINT [PK_Character] PRIMARY KEY NONCLUSTERED ( [Name] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF USE [MuOnline] GO /****** Object: Table [dbo].[MEMB_INFO] Script Date: 06/12/2012 01:33:04 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[MEMB_INFO]( [memb_guid] [int] IDENTITY(1,1) NOT NULL, [memb___id] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [memb__pwd] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [memb_name] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [sno__numb] [char](13) COLLATE Chinese_PRC_CS_AS_KS_WS NOT NULL, [post_code] [char](6) COLLATE Chinese_PRC_CS_AS_KS_WS NULL, [addr_info] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [addr_deta] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [tel__numb] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL, [phon_numb] [varchar](18) COLLATE Chinese_PRC_CI_AS NULL, [mail_addr] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [fpas_ques] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [fpas_answ] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [job__code] [char](2) COLLATE Chinese_PRC_CI_AS NULL, [appl_days] [datetime] NULL, [modi_days] [datetime] NULL, [out__days] [datetime] NULL, [true_days] [datetime] NULL, [mail_chek] [char](1) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_MEMB_INFO_mail_chek] DEFAULT ((0)), [bloc_code] [char](1) COLLATE Chinese_PRC_CI_AS NOT NULL, [ctl1_code] [char](1) COLLATE Chinese_PRC_CI_AS NOT NULL, [JF] [int] NULL CONSTRAINT [DF__MEMB_INFO__JF__10566F31] DEFAULT ((0)), [servercode] [int] NOT NULL CONSTRAINT [DF_MEMB_INFO_servercode] DEFAULT ((0)), [dingdan] [varbinary](50) NULL, [usedtime] [int] NOT NULL CONSTRAINT [DF_MEMB_INFO_usedtime] DEFAULT ((0)), [cspoints] [int] NULL CONSTRAINT [DF_MEMB_INFO_cspoints] DEFAULT ((0)), [activation_id] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [confirmed] [int] NULL, [Country] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [Gender] [int] NULL, [SecretAnswer] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL, [SecretQuestion] [int] NULL, [VipStat] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [VipStamp] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [MasterKey] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL, [AccountLock] [tinyint] NULL CONSTRAINT [DF__MEMB_INFO__Accou__2AD55B43] DEFAULT ((0)), [Remark] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [TempCredits] [int] NULL CONSTRAINT [DF__MEMB_INFO__TempC__2BC97F7C] DEFAULT ((0)), [memb__pwd2] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [votes] [int] NOT NULL CONSTRAINT [DF__MEMB_INFO__votes__6E8B6712] DEFAULT ((0)), CONSTRAINT [PK_MEMB_INFO] PRIMARY KEY NONCLUSTERED ( [memb___id] DESC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF
0 Likes 0 ·
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
0 Likes 0 ·
@zohan So sorry, but I am unable to understand you. What you are stating is the same that is done in the example. Why don't you run the example in your test environment and let me know where it should be corrected?
0 Likes 0 ·
i will execute the command now
0 Likes 0 ·
Yes this is wat i wanted @usman butt you are the man!!! now how i ajust the SQL code for my database? The code works on the tempdb and the results are the ones i need
0 Likes 0 ·
You can make a stored procedure for the following. But it is only you who can fit it in your DB against the requirement. You may also want to handle the errors etc. more efficiently SET XACT_ABORT, NOCOUNT ON; BEGIN TRY BEGIN TRAN DECLARE @Members TABLE (memb_id VARCHAR(10)) UPDATE MEMBINFO SET cspoints = a.cspoints + b.PCPoints OUTPUT INSERTED.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 ) 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
0 Likes 0 ·
Error Msg 207, Level 16, State 1, Line 30 Invalid column name 'XACT_STATE'. i think the code on this website dont alow me bars ____ to the code see this link to undestand the https://www.dropbox.com/s/nj0cxzzqyxl5cyy/New%20Text%20Document.txt your code modify to my sql data and the eror below
0 Likes 0 ·
@zohan Change XACT_STATE to XACT_STATE() and it will work
0 Likes 0 ·
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
0 Likes 0 ·
Usman Butt avatar image
Usman Butt answered
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 USE [tempdb] GO IF OBJECT_ID('tempdb.dbo.CHARACTER') IS NOT NULL DROP TABLE [CHARACTER] IF OBJECT_ID('tempdb.dbo.MEMBINFO') IS NOT NULL DROP TABLE dbo.MEMBINFO CREATE TABLE dbo.MEMBINFO ( memb_id VARCHAR(10), cspoints INT ) CREATE TABLE dbo.CHARACTER ( AccountID VARCHAR(10), PCPoints INT ) GO /*==== INITIALIZE THE MEMBINFO WITH SOME DUMMY DATA ===*/ INSERT [MEMBINFO] ( [memb_id] ,[cspoints] ) SELECT '1', 10 UNION ALL SELECT '2',20 UNION ALL SELECT '3',30 UNION ALL SELECT '4',40 /*=== INSERT DUMMY DATA INTO #CHARACTER TABLE =====*/ INSERT [CHARACTER] ( [AccountID] ,[PCPoints] ) SELECT '1', 10 UNION ALL SELECT '2',20 UNION ALL SELECT '3',30 -- EXCLUDED THE MEMBER 4 GO SET XACT_ABORT ON; BEGIN TRY BEGIN TRAN DECLARE @Members TABLE (memb_id VARCHAR(10)) UPDATE MEMBINFO SET cspoints = a.cspoints + b.PCPoints OUTPUT INSERTED.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 ) SELECT * FROM [dbo].[CHARACTER] AS C SELECT * FROM [dbo].[MEMBINFO] AS M COMMIT TRAN END TRY BEGIN CATCH SELECT ERROR_MESSAGE(), ERROR_LINE() ROLLBACK TRAN END CATCH
4 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@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.
2 Likes 2 ·
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
1 Like 1 ·
DDL code now found in comments under Question.
0 Likes 0 ·
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][1] [1]: http://dl.dropbox.com/u/61933347/7-7-2012%2012-02-38%20PM.avi
0 Likes 0 ·
zohan avatar image
zohan answered
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 _ 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
9 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@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.
0 Likes 0 ·
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][1] [1]: http://dl.dropbox.com/u/61933347/7-7-2012%2012-02-38%20PM.avi
0 Likes 0 ·
Anyone know wat is the pproblem here ? i have try like crazy did not work why?
0 Likes 0 ·
@zohan Can you please post some data from both the tables? Then it would be easier for me to understand the problem.
0 Likes 0 ·
i have post the tables dll theere wat data do you need , ? Thid you see the video Link
0 Likes 0 ·
Show more comments
zohan avatar image
zohan answered
@usman butt dont worry thx ... i dont see the problem i have MEMB_INFO > memb____id and in Character > AccountID i will read again and carful see where the problem is can be a problem in my SQL?
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zohan avatar image
zohan answered
So this is all the data i have it here , from the 2 tables , wat data do you need from them USE [MuOnline] GO /****** Object: Table [dbo].[Character] Script Date: 06/12/2012 01:32:46 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Character]( [AccountID] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [Name] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [cLevel] [int] NULL CONSTRAINT [DF_Character_cLevel] DEFAULT ((1)), [LevelUpPoint] [int] NULL CONSTRAINT [DF_Character_LevelUpPoint] DEFAULT ((0)), [Class] [tinyint] NULL, [Experience] [int] NULL CONSTRAINT [DF_Character_Experience] DEFAULT ((0)), [Strength] [smallint] NULL, [Dexterity] [smallint] NULL, [Vitality] [smallint] NULL, [Energy] [smallint] NULL, [Inventory] [varbinary](1728) NULL, [MagicList] [varbinary](180) NULL, [Money] [int] NULL CONSTRAINT [DF_Character_Money] DEFAULT ((0)), [Life] [real] NULL, [MaxLife] [real] NULL, [Mana] [real] NULL, [MaxMana] [real] NULL, [MapNumber] [smallint] NULL, [MapPosX] [smallint] NULL, [MapPosY] [smallint] NULL, [MapDir] [tinyint] NULL CONSTRAINT [DF_Character_MapDir] DEFAULT ((0)), [PkCount] [int] NULL CONSTRAINT [DF_Character_PkCount] DEFAULT ((0)), [PkLevel] [int] NULL CONSTRAINT [DF_Character_PkLevel] DEFAULT ((3)), [PkTime] [int] NULL CONSTRAINT [DF_Character_PkTime] DEFAULT ((0)), [MDate] [smalldatetime] NULL, [LDate] [smalldatetime] NULL, [CtlCode] [tinyint] NULL CONSTRAINT [DF_Character_CtlCode] DEFAULT ((0)), [DbVersion] [tinyint] NULL CONSTRAINT [DF__Character__DbVer__3A4CA8FD] DEFAULT ((0)), [Quest] [varbinary](50) NULL CONSTRAINT [DF__Character__Quest__40F9A68C] DEFAULT ((0)), [Leadership] [smallint] NULL CONSTRAINT [DF__Character__Leade__6FB49575] DEFAULT ((0)), [ChatLimitTime] [smallint] NULL CONSTRAINT [DF__Character__ChatL__70A8B9AE] DEFAULT ((0)), [FruitPoint] [int] NULL CONSTRAINT [DF__Character__Fruit__44CA3770] DEFAULT ((0)), [JHDX] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL, [JHtype] [tinyint] NULL, [cspoints] [int] NULL, [Grand_Resets] [int] NOT NULL CONSTRAINT [DF__Character__Grand__42E1EEFE] DEFAULT ((0)), [mu_id] [int] IDENTITY(1,1) NOT NULL, [Resets] [int] NOT NULL CONSTRAINT [DF__Character__Reset__43D61337] DEFAULT ((0)), [EDSPostCmd] [int] NOT NULL CONSTRAINT [DF_Character_EDSPostCmd] DEFAULT ((0)), [CirePkRank] [int] NOT NULL CONSTRAINT [DF_Character_CirePkRank] DEFAULT ((0)), [EDSPostBanTime] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_Character_EDSPostBanTime] DEFAULT ((0)), [Married] [tinyint] NOT NULL CONSTRAINT [DF_Character_Married] DEFAULT ((0)), [MarryName] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL, [GensRank] [smallint] NOT NULL CONSTRAINT [DF_Character_GensRank] DEFAULT ((0)), [GensContribution] [int] NOT NULL CONSTRAINT [DF_Character_GensContribution] DEFAULT ((0)), [GensType] [tinyint] NOT NULL CONSTRAINT [DF_Character_GensType] DEFAULT ((0)), [GensLastLeave] [int] NOT NULL CONSTRAINT [DF_Character_GensLastLeave] DEFAULT ((0)), [GensKnight] [tinyint] NOT NULL DEFAULT ((0)), [PCPoints] [int] NOT NULL DEFAULT ((0)), [TempPcPoints] [int] NOT NULL DEFAULT ((0)), CONSTRAINT [PK_Character] PRIMARY KEY NONCLUSTERED ( [Name] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF USE [MuOnline] GO /****** Object: Table [dbo].[MEMB_INFO] Script Date: 06/12/2012 01:33:04 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[MEMB_INFO]( [memb_guid] [int] IDENTITY(1,1) NOT NULL, [memb___id] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [memb__pwd] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [memb_name] [varchar](10) COLLATE Chinese_PRC_CI_AS NOT NULL, [sno__numb] [char](13) COLLATE Chinese_PRC_CS_AS_KS_WS NOT NULL, [post_code] [char](6) COLLATE Chinese_PRC_CS_AS_KS_WS NULL, [addr_info] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [addr_deta] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [tel__numb] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL, [phon_numb] [varchar](18) COLLATE Chinese_PRC_CI_AS NULL, [mail_addr] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [fpas_ques] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [fpas_answ] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [job__code] [char](2) COLLATE Chinese_PRC_CI_AS NULL, [appl_days] [datetime] NULL, [modi_days] [datetime] NULL, [out__days] [datetime] NULL, [true_days] [datetime] NULL, [mail_chek] [char](1) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_MEMB_INFO_mail_chek] DEFAULT ((0)), [bloc_code] [char](1) COLLATE Chinese_PRC_CI_AS NOT NULL, [ctl1_code] [char](1) COLLATE Chinese_PRC_CI_AS NOT NULL, [JF] [int] NULL CONSTRAINT [DF__MEMB_INFO__JF__10566F31] DEFAULT ((0)), [servercode] [int] NOT NULL CONSTRAINT [DF_MEMB_INFO_servercode] DEFAULT ((0)), [dingdan] [varbinary](50) NULL, [usedtime] [int] NOT NULL CONSTRAINT [DF_MEMB_INFO_usedtime] DEFAULT ((0)), [cspoints] [int] NULL CONSTRAINT [DF_MEMB_INFO_cspoints] DEFAULT ((0)), [activation_id] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [confirmed] [int] NULL, [Country] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [Gender] [int] NULL, [SecretAnswer] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL, [SecretQuestion] [int] NULL, [VipStat] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [VipStamp] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [MasterKey] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL, [AccountLock] [tinyint] NULL CONSTRAINT [DF__MEMB_INFO__Accou__2AD55B43] DEFAULT ((0)), [Remark] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [TempCredits] [int] NULL CONSTRAINT [DF__MEMB_INFO__TempC__2BC97F7C] DEFAULT ((0)), [memb__pwd2] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [votes] [int] NOT NULL CONSTRAINT [DF__MEMB_INFO__votes__6E8B6712] DEFAULT ((0)), CONSTRAINT [PK_MEMB_INFO] PRIMARY KEY NONCLUSTERED ( [memb___id] DESC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zohan avatar image
zohan answered
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
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zohan avatar image
zohan answered
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
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.