I want to know how to clean ID and character data in the database.

02/01/2018 12:03 thetoys#1
I want to know how to clean ID and character data in the database.:mofo::mofo:
02/01/2018 17:35 C_O_R_E#2
I'm not familiar with SQL in general and haven't looked into flyff databases.
By a quick eye catch, just saw that CHARACTER01 stores all created ones, which might be the right database to wipe out. If you want to kick out also every created account, drop all entries in ACCOUNT database.

TRUNCATE - clears all entries/records of a specified table but causing problems with PK/FK
See: [Only registered and activated users can see links. Click Here To Register...]
as @[Only registered and activated users can see links. Click Here To Register...] mentioned. (Haven't known that)

READ MORE about TRUNCATE
[Only registered and activated users can see links. Click Here To Register...]

Not sure about LOGGING_01 database.


$Edit: Ok, as it seems like all tables (regarding their entries) of LOGGING also needs to get kicked out.

$Edit2: Do not truncate BASE_VALUE_TBL since it contains all base values for new characters based on gender.
02/02/2018 12:12 xTwiLightx#3
Better use delete + checkident to really "reset" the databases - truncate only deletes all entries while having problems with foreign keys/constaints.

Code:
USE ACCOUNT_DBF
GO

EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DBCC CHECKIDENT (''?'', RESEED, 1)'
GO
Code:
USE CHARACTER_01_DBF
GO

EXEC sp_MSForEachTable @ command1 = 'ALTER TABLE ? NOCHECK CONSTRAINT ALL',  @ whereand ='and o.name <> ''BASE_VALUE_TBL'''
EXEC sp_MSForEachTable @ command1 = 'DELETE FROM ?',  @ whereand ='and o.name <> ''BASE_VALUE_TBL'''
EXEC sp_MSForEachTable @ command1 = 'ALTER TABLE ? CHECK CONSTRAINT ALL',  @ whereand ='and o.name <> ''BASE_VALUE_TBL'''
EXEC sp_MSForEachTable @ command1 = 'DBCC CHECKIDENT (''?'', RESEED, 1)',  @ whereand ='and o.name <> ''BASE_VALUE_TBL'''
GO
(remove the spaces between the '@' and the variable names "command1" and "whereand")

Better back up your BASE_VALUE_TBL, even if this script should exclude it.

Code:
USE LOGGING_01_DBF
GO

EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DBCC CHECKIDENT (''?'', RESEED, 1)'
GO
Regarding the RANKING_DBF: I bet no one really uses it, so it can be ignored.
02/06/2018 11:21 KingKeesie#4
Yes but be sure you only delete entries with idplayer because there are skill tables and tables like BASE and stuff
02/06/2018 14:52 xTwiLightx#5
Quote:
Originally Posted by KingKeesie View Post
Yes but be sure you only delete entries with idplayer because there are skill tables and tables like BASE and stuff
For character-based data, only the BASE_VALUE_TBL data is important to be kept.

Logging data can be cleared for sure (because old logs won't fit the new character data anymore), account data can be kept but isn't a must.