Sorting Sql TBL_mongen alphabetically, or newest added.

Toddwhite

More like Retodd
Golden Oldie
Jul 28, 2006
1,589
7
124
hi whenever i close the mongen table all the rows scramble randomly, i want to have them ideally so that the latest 1s ive added stay at the bottom in order, or atleast be able to arrange them alphabetically, any help plz?
 

samhag

Dedicated Member
Dedicated Member
Jul 31, 2008
213
0
42
Open enterprise manager, navigate to your list of tables, right click on the mongen table and select design table, right click on the column that you want table sorted by and select set primary key
 
Upvote 0

Toddwhite

More like Retodd
Golden Oldie
Jul 28, 2006
1,589
7
124
Open enterprise manager, navigate to your list of tables, right click on the mongen table and select design table, right click on the column that you want table sorted by and select set primary key


Thanks thts how to do it, but i got this error msg

'TBL_MONGEN' table
- Unable to create index 'PK_TBL_MONGEN'.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is '6'.
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not create constraint. See previous errors.
[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.


how do i fix this?
 
Upvote 0

samhag

Dedicated Member
Dedicated Member
Jul 31, 2008
213
0
42
You must have 2 or more rows in the table that are identical, delete one so that there are no duplicates.
 
Upvote 0

Toddwhite

More like Retodd
Golden Oldie
Jul 28, 2006
1,589
7
124
You must have 2 or more rows in the table that are identical, delete one so that there are no duplicates.

WHEN TRYING TO DELETE ENTRIES IT SAYS

key column information is incorrect or insufficient: too many results were affected by update.

how do i get rid of this so i can delete whatever i want?
 
Upvote 0

samhag

Dedicated Member
Dedicated Member
Jul 31, 2008
213
0
42
click on the SQL button in enterprise manager when you have the table open.
 
Upvote 0

Toddwhite

More like Retodd
Golden Oldie
Jul 28, 2006
1,589
7
124
it says to do this...

SELECT col1, col2, count(*)
FROM t1
GROUP BY col1, col2
HAVING count(*) > 1

i assume this is a query to find ure duplicate values.

so far i have done this,

SELECT COUNT(*) AS Expr11, COUNT(*) AS Expr12, FLD_MAPNAME AS Expr1, FLD_X AS Expr2, FLD_MONNAME AS Expr3, FLD_Y AS Expr4,
FLD_RANGE AS Expr5, FLD_COUNT AS Expr6, FLD_GENTIME AS Expr7, FLD_SMALLGENRATE AS Expr8, FLD_DESCRIPTION AS Expr10
FROM TBL_MONGEN
GROUP BY FLD_MAPNAME, FLD_X, FLD_MONNAME, FLD_Y, FLD_RANGE, FLD_COUNT, FLD_GENTIME, FLD_SMALLGENRATE, FLD_DESCRIPTION

but dont know how to add the HAVING command.
 
Upvote 0

Toddwhite

More like Retodd
Golden Oldie
Jul 28, 2006
1,589
7
124
jsut realised u cant make anything primary key, cus tht means u cant have same of it, and mongens u need to have same for example same mapname (need to spawns more than 1 type of mob), same coords etc as u need same coords.

u cant use primary key u need like a sort query u can run to make it alphabetical.
 
Last edited:
Upvote 0

Dazz

LOMCN Veteran
Veteran
Apr 12, 2008
296
0
43
Right click TbL_MONGEN -> Query -> Un select all boxes except from FLD_NAME -> Order -> Ascending -> rightclick run

Tends to work..
 
Upvote 0

Bon

Legend
Legendary
Jul 29, 2004
6,741
342
330
Kent, UK
ur all wrong... u just index the table

ive alrdy done it for him

why would u use primary key lol, pointless.
 
Upvote 0

samhag

Dedicated Member
Dedicated Member
Jul 31, 2008
213
0
42
why would u use primary key lol, pointless.

i've no idea tbh, remember reading it somewhere that thats the way to do it lol. I didnt have the problem as all my tables have indexes in them.

oh well live and learn :D
 
Upvote 0