Page 1 of 1

Converting NHL2005 DB into NHL2004

Posted: Fri Nov 26, 2004 1:59 am
by fatpat
Hey Suchy,

Not sure if you can answer all of my questions, but anything you can help with will be great!

Like several other people, I am looking to load the NHL2005 Rosters into NHL2004. I think I have covered most of my bases already, but in preparing things so far, I have uncovered some questions>

Where I am right now is sitting with 3 DB Tables converted from NHL2005 into the NHL2004 layout - SPBT, SGAI, and SPAI. I believe that I can use TDBaccess to overwrite the same tables in NHL2004.tdb and NHL2004PC.tdb that exist in DB.viv.

To get to this point, I used BigGui to extract the contents of the DB.viv, then I used TDBviewer to export the full contents of the three tables from NHL2004.tdb. After carefully checking the table format, I merged the SACC and WACC into one field named ACCU, I merged SPOW and WPOW into one field called SHPW to create the new SPAI table. I deleted the TUCK, INTL, and TEAM fields to create the new SPBT. I left the format the same for SGAI.

After ensureing the fields were the same, and ordered the same, I then went through a process of identifying all the players that were the same (based on INDX) in both DBs, along with which players were deleted (retired) from 2004 and which players were newly added into 2005. It turned out that there were more players in 2004 than in 2005. I overwrote the data of the newly created players this season, overtop of players that retired last year.

To make sure nothing would corrupt, I ensured that there were the same number of records in each table as in the original NHL2004.tdb.

If all that is correct so far, then hopefully I am ready to overwrite the tables in the TDB and repack the DB.viv. This leads me to my questions.

First. Do I have to retain the INDX numbers from 2004, or can I use the INDX numbers from 2005. THis only affects the new players that I overwrote over retired player numbers, but because the old DB ended at INDX 3641, and 2005 ends at 4326, I am afraid that if I use the 2005 INDX numbers, I will get a corruption somewhere. My preference is to use the 2005 INDX numbers, but I have prepared the tables both ways, just in case.

Second. Do I have to maintain the same number of records for each table, or is there a limit that is set that I can stay under. If I wanted to add another 100 created players for example, could I do that in the same way, or does the database need the tables to remain the same size?

Last question. Did I overlook anything in my process. I believe I have covered everything I need to do to bring the 2005 rosters into 2004, but if I am missing anything, please let me know.

I hope to overwrite the DB sometime this weekend and test out the rosters. I will post the results here for anyone that is interested.

As always, thanks for the incredible tools that you create to allow us to make this game so much more enjoyable.


Posted: Fri Nov 26, 2004 3:22 am
by Artem
Converting players tables is only the small fraction of what needs to be done to perform 2005-to-2004 conversion and it's actually a very simple step compared to some other things.

First of all, there is no easy way to import whole tables from one db to another. So you have to add it record by record. There are several things I need to correct you on:
- You don't actually need to order fields in any particular way, and you don't need to delete fields. As long as 2004 fields exist, the game doesn't care what else is there in the db.
- I don't believe it is nesessary to match ids for players. Basically, the way I would proceed to convert just the players is empty all 3 NHL2004 tables and import record by record players from NHL 2005 db.

To answer some of your questions:
- You don't need to keep the same size, you can add/remove records. However the number of players is bounded by 2 things: 65536 - max number of records in the db, more importantly - 2^sizeof(INDX) field.
- There is a big issue that you indeed overlooked: PLAY table and all tables that depend on it: FREE and ROST. PLAY contains all the instances of players in SPBT pool. FREE is free agents and ROST is team rosters.
Basically, you have to empty all 3 tables and fill them with data from corresponding 2005 db. The format is the same, but you can't do it all in one shot as I said earlier. You have to copy data record by record.

Posted: Sun Nov 28, 2004 6:50 pm
by fatpat
Thanks very much for the responce Suchy.

After looking through the DB alot more carefully, I see where I missed the table instances that you mentioned.

As far as my attempt to convert the 2005 DB into 2004, it definitely is not worth the effort of bringing the players in one at a time.

I am curious if it would be possible for you to add the functionality to completely overwrite an entire table with TDBaccess? I can see lots of problems using a function like that to create players, but it might be useful for editing attributes, amongst other things.

Thanks for the quick reply and keep up the excellent work!