PDA

View Full Version : [HELP] lin_NominateHeroes


m4rk
05.10.2006, 06:16
10/05/2006 08:00:xx.xx4, Error sql: EXEC lin_NominateHeroes 1, 1, 1159653600 (0)
10/05/2006 08:00:xx.xx7, Error 21S01:[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name or number of supplied values does not match table definition.

So this is a cached error given from time to time.. In fact I get quite a flood of it, always same msg and same numbers.

¿Anyone can help me out on this? My SQL guy is Missing in action T_T

I guess I should check the stored procedure and check what column it's looking for and check if it exists or not right?

kin
05.10.2006, 07:05
I think you have all tables, but the value inserted is in wrong format.

m4rk
06.10.2006, 07:01
CREATE PROCEDURE dbo.lin_NominateHeroes
(
@now_season INT,
@new_step INT,
@new_season_start_time INT
)
AS
SET NOCOUNT ON

UPDATE user_nobless
SET hero_type = 0

CREATE TABLE #hero_candidate (char_id INT, main_class INT, match_count INT, olympiad_point INT)
INSERT INTO #hero_candidate
SELECT un.char_id, ud.subjob0_class, un.match_count, un.olympiad_point
FROM user_nobless un, user_data ud
WHERE un.char_id = ud.char_id AND un.match_count >= 5 AND un.olympiad_win_count >= 1

CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)

DECLARE @hero_candidate_class INT
DECLARE hero_candidate_cursor CURSOR FOR
SELECT DISTINCT main_class FROM #hero_candidate

OPEN hero_candidate_cursor

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class

WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO #highest_score
SELECT TOP 1 main_class, olympiad_point, match_count
FROM #hero_candidate
WHERE main_class = @hero_candidate_class
ORDER BY olympiad_point DESC, match_count DESC

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class
END

CLOSE hero_candidate_cursor
DEALLOCATE hero_candidate_cursor

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
INSERT INTO #highest_score_nobless
SELECT c.char_id, c.main_class FROM #hero_candidate c, #highest_score s
WHERE c.main_class = s.main_class AND c.olympiad_point = s.olympiad_point AND c.match_count = s.match_count

CREATE TABLE #hero (char_id INT, main_class INT)
INSERT INTO #hero
SELECT char_id, main_class FROM #highest_score_nobless WHERE main_class IN (SELECT main_class FROM #highest_score_nobless GROUP BY main_class HAVING COUNT(main_class) = 1)

UPDATE user_nobless
SET hero_type = 1, win_count = win_count+1
WHERE char_id IN (SELECT char_id FROM #hero)

UPDATE user_nobless
SET previous_point = olympiad_point

UPDATE user_nobless
SET olympiad_point = 0, match_count = 0, olympiad_win_count = 0, olympiad_lose_count = 0

INSERT INTO olympiad_result
SELECT @now_season, main_class, char_id, olympiad_point, match_count FROM #hero_candidate

INSERT INTO olympiad
(step, season_start_time) VALUES (@new_step, @new_season_start_time)

SELECT @@IDENTITY





GO

I put this as a log of what I try to fix it, in case anyone has the same problem.

So... I will check all the tables affected by insert commands:
hero_candidate
highest_score
highest_score_nobless
hero
olympiad result

tpuNIsher
02.11.2006, 08:56
managed to fix it? m4rk?

m4rk
02.11.2006, 09:22
well first I noticed those tables weren't created so I created them looking in stored procedures. After that I took olympiad off so I haven't really checked... will do shortly as my players are reaching high levels (if I have time i'll run a test today or tomorrow and update).

tpuNIsher
02.11.2006, 09:42
Looking forward to the result :>

Haygor
02.11.2006, 15:19
after finally getting it to try to roll over on our two servers, I got it to work on one server but tgot these error n the other server, so these tells me there is a difference with converted databases, digging now to try and find this "minor" difference

Haygor
02.11.2006, 16:00
Anyone out there that is willing to do the digging and post the results here, I need to know what columns are set in your olympiad_result table inside lin2world. I think there is extra columns that is throwing a converted database off.

m4rk
02.11.2006, 19:01
Ok seems like my problems were solved by me creating the tables...

SO create the tables and set primary key well (remember must be something whose value can't repeat) and check ^_^

CREATE TABLE #hero_candidate (char_id INT, main_class INT, match_count INT, olympiad_point INT)
primary key: char_id

CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)
primary key: main_class

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
primary key: char_id

CREATE TABLE #hero (char_id INT, main_class INT)
primary key: char_id

djvogans
02.11.2006, 19:39
what means # in front of the table ? hidden table or ? cause in 2k5 i can explore those table

m4rk
02.11.2006, 19:45
I don't know :S that's the stored procedure...
as it wasn't creating correctly those tables and reporting the error on the first post I created them by hand and now it seems OK

djvogans
02.11.2006, 20:35
thank you for info talmage

djvogans
01.01.2007, 12:45
01/01/2007 14:31:xx.xx9, Error sql: EXEC lin_NominateHeroes 1, 1, 1167523200 (0)
01/01/2007 14:31:xx.xx9, Error 21S01:[Microsoft][SQL Native Client][SQL Server]Insert Error: Column name or number of supplied values does not match table definition.



one fix : check olympiad_result table format :

CREATE TABLE [dbo].[olympiad_result] (
[season] int NOT NULL ,
[class] int NOT NULL ,
[char_id] int NOT NULL ,
[point] int NOT NULL ,
[match_count] int NOT NULL ,
[olympiad_win_count] int NOT NULL DEFAULT (0) ,
[olympiad_lose_count] int NOT NULL DEFAULT (0)
)
GO

ALTER TABLE [dbo].[olympiad_result] WITH NOCHECK
ADD CONSTRAINT [PK_olympiad_result] PRIMARY KEY CLUSTERED ( [season],[class],[char_id] )

kok
27.03.2007, 05:40
how many registered nobless need for they would throw to the stadium ?

zaferk
27.03.2007, 05:59
never quite counted, but its 5 i think

seraphii
27.03.2007, 08:06
for both competiton need 5 players nobless, class match and no class match.

Ps: in the class match need five nobless with same class. ex: five wind rider