Latest News: OOTP PATCH 9.2.2 released - buy before Oct. 17th and save $10! - OOTP 9 RELEASED! - Title Bout Championship Boxing 2.5 released! - OOTP 2007 receives Editors Choice Award from PC Gamer - Inside the Park Baseball Patch 1.03 released, DEMO now available

Click here to download Out of the Park Baseball 9!

Go Back   OOTP Developments Forums > OUT OF THE PARK BASEBALL 9 > OOTP 9 - Mods > Database Tools
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Database Tools Do you need to take a dump? SQL gurus welcome

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-06-2006, 10:24 AM   #1 (permalink)
Moderator*
 
ctorg's Avatar
 
Join Date: Nov 2002
Location: Brooklyn, NY
Posts: 9,372
An easier way to automatically get data into Access

I've used Access a lot, but I have very rarely delved into any real VBA coding with it, so I went about setting up a way to automatically import all the csv files by making a very long macro that imports each one with a TransferText action. There are two glitches. One is that "NULL" in the players_streak.csv file creates error messages, which don't amount to much because it just erases "NULL". The other is that, in the leagues.csv file, all_star_text0 and 1 are messed up and need to have their data deleted in order for the file to import the rest of the lines (I don't even know what these are supposed to be).

I'm wondering if there is a more straightforward way of importing the data into Access. I know I can do an Access SQL dump, but I don't know how to get it into Access once the dump is done. I actually used the table creation lines from the Access SQL dump to create 61 separate action queries that create the tables and assign primary keys, since this was the only way I knew how to assign primary keys, and made a macro that would run all 61 action queries in a row.

This seems like a long workaround for something that should be pretty simple, though. I mean, it works, but is there an easier way?
__________________
THE VERY US ARTISTS - A project for musicians and visual artists

My music


Currently reading:
Thirteen by Richard Morgan


"When the trees blow back and forth, that's what makes the wind." - Steven Wright

Fjord emena pancreas thorax fornicate marmalade morpheme proteolysis smaxa cabana offal srue vitriol grope hallelujah lentils
ctorg is offline   Reply With Quote
Old 10-11-2006, 09:26 PM   #2 (permalink)
All Star Reserve
 
Kyros's Avatar
 
Join Date: May 2006
Posts: 981
http://www.sim2005.com/Access/Default.htm

This is from Larry Anderson.
Kyros is offline   Reply With Quote
Old 10-12-2006, 06:50 AM   #3 (permalink)
Moderator*
 
ctorg's Avatar
 
Join Date: Nov 2002
Location: Brooklyn, NY
Posts: 9,372
Quote:
Originally Posted by Kyros View Post
http://www.sim2005.com/Access/Default.htm

This is from Larry Anderson.
Thanks, but I already knew all that stuff. In fact, I basically made a set of macros and queries that automates the process of getting the data in. I was just wondering if there was anything simpler. The game allows a dump that creates a set of sql files that look like they would work in MS Access, but I don't know how to get them to run.

I guess if there was a way, Larry would have posted about it. I'm just baffled as to why there is a way to create these files if they are not usable.
__________________
THE VERY US ARTISTS - A project for musicians and visual artists

My music


Currently reading:
Thirteen by Richard Morgan


"When the trees blow back and forth, that's what makes the wind." - Steven Wright

Fjord emena pancreas thorax fornicate marmalade morpheme proteolysis smaxa cabana offal srue vitriol grope hallelujah lentils
ctorg is offline   Reply With Quote
Old 10-12-2006, 12:59 PM   #4 (permalink)
All Star Reserve
 
Kyros's Avatar
 
Join Date: May 2006
Posts: 981
Quote:
Originally Posted by ctorg View Post
Thanks, but I already knew all that stuff. In fact, I basically made a set of macros and queries that automates the process of getting the data in. I was just wondering if there was anything simpler. The game allows a dump that creates a set of sql files that look like they would work in MS Access, but I don't know how to get them to run.

I guess if there was a way, Larry would have posted about it. I'm just baffled as to why there is a way to create these files if they are not usable.
Sorry man. I wish I could have helped. If you do find a better way, please...let us know. I would love to know as well.
Kyros is offline   Reply With Quote
Old 10-12-2006, 01:55 PM   #5 (permalink)
Moderator*
 
ctorg's Avatar
 
Join Date: Nov 2002
Location: Brooklyn, NY
Posts: 9,372
I will. I've been searching all over for a way to do this stuff, but I can't find anything.
__________________
THE VERY US ARTISTS - A project for musicians and visual artists

My music


Currently reading:
Thirteen by Richard Morgan


"When the trees blow back and forth, that's what makes the wind." - Steven Wright

Fjord emena pancreas thorax fornicate marmalade morpheme proteolysis smaxa cabana offal srue vitriol grope hallelujah lentils
ctorg is offline   Reply With Quote
Old 10-12-2006, 02:01 PM   #6 (permalink)
Moderator*
 
ctorg's Avatar
 
Join Date: Nov 2002
Location: Brooklyn, NY
Posts: 9,372
In the meantime, I'll upload this MS Access file that contains what I do. Under Macros, if you run CreateAllTables, it will set up all the tables. Then run ImportAll to import the data. Two catches are that you have to make the corrections I mentioned above and the csv files have to be in c:\OOTPdata on your hard drive (so move them there first).

Also, it helps if you turn off warning messages for action queries so that you don't get a bunch of them, since the macro runs a series of queries.
Attached Files
File Type: zip data importer.zip (27.2 KB, 50 views)
__________________
THE VERY US ARTISTS - A project for musicians and visual artists

My music


Currently reading:
Thirteen by Richard Morgan


"When the trees blow back and forth, that's what makes the wind." - Steven Wright

Fjord emena pancreas thorax fornicate marmalade morpheme proteolysis smaxa cabana offal srue vitriol grope hallelujah lentils
ctorg is offline   Reply With Quote
Old 10-12-2006, 02:25 PM   #7 (permalink)
All Star Reserve
 
Kyros's Avatar
 
Join Date: May 2006
Posts: 981
Quote:
Originally Posted by ctorg View Post
In the meantime, I'll upload this MS Access file that contains what I do. Under Macros, if you run CreateAllTables, it will set up all the tables. Then run ImportAll to import the data. Two catches are that you have to make the corrections I mentioned above and the csv files have to be in c:\OOTPdata on your hard drive (so move them there first).

Also, it helps if you turn off warning messages for action queries so that you don't get a bunch of them, since the macro runs a series of queries.
Very....very cool! Thanks!!!
Kyros is offline   Reply With Quote
Old 11-21-2006, 12:02 PM   #8 (permalink)
Minors (Single A)
 
Join Date: Nov 2003
Posts: 77
I am not completely sure I understand what your question is. What I think you are saying is that once you do the SQL dump you are having to create an extensive macro to get the data into Access and run that macro each time you dump.

If that is indeed what you are doing then it is similar to what I was doing. I found thought that it was easier to export to a CSV file and link the tables I wanted in Access to the files in the import_export folder. Doing it this way I do not have to run code each time I dump to update the Access tables.

Hope that made some sense. If not let me know and I will try again.

Good Luck!
toddnorr is offline   Reply With Quote
Old 11-21-2006, 01:16 PM   #9 (permalink)
Moderator*
 
ctorg's Avatar
 
Join Date: Nov 2002
Location: Brooklyn, NY
Posts: 9,372
Quote:
Originally Posted by toddnorr View Post
I am not completely sure I understand what your question is. What I think you are saying is that once you do the SQL dump you are having to create an extensive macro to get the data into Access and run that macro each time you dump.

If that is indeed what you are doing then it is similar to what I was doing. I found thought that it was easier to export to a CSV file and link the tables I wanted in Access to the files in the import_export folder. Doing it this way I do not have to run code each time I dump to update the Access tables.

Hope that made some sense. If not let me know and I will try again.

Good Luck!
I suppose linking it would make things a bit easier, but right now, I am trying to get all the years into a single database, which has become a bit of a complicated project. Basically, I have to add year fields to any place where there are no years and such. In this case, I need to have the data in unalterable tables rather than linked. I actually haven't worked on this in several weeks, so I've gotten a little fuzzy on exactly what I was doing now.
__________________
THE VERY US ARTISTS - A project for musicians and visual artists

My music


Currently reading:
Thirteen by Richard Morgan


"When the trees blow back and forth, that's what makes the wind." - Steven Wright

Fjord emena pancreas thorax fornicate marmalade morpheme proteolysis smaxa cabana offal srue vitriol grope hallelujah lentils
ctorg is offline   Reply With Quote
Old 11-21-2006, 02:17 PM   #10 (permalink)
Hall Of Famer
 
Comedian2004's Avatar
 
Join Date: Nov 2004
Location: In a house in Saint Cloud, Florida.
Posts: 6,396
You may want to check out my AUContract program. It basically loads a whole bunch of SQL files into memory and then creates one large CSV dump that you can import into Access.
__________________
Visit www.planetootp.com for my MODS. Like BLUES? Visit www.smokestacklightnin.com, you will LOVE it! New show every Monday!! New Blues HOF!
Comedian2004 is offline   Reply With Quote
Old 11-22-2006, 07:16 AM   #11 (permalink)
Moderator*
 
ctorg's Avatar
 
Join Date: Nov 2002
Location: Brooklyn, NY
Posts: 9,372
Quote:
Originally Posted by Comedian2004 View Post
You may want to check out my AUContract program. It basically loads a whole bunch of SQL files into memory and then creates one large CSV dump that you can import into Access.
Thanks. That sounds useful. Due to time constraints caused by having two preschool kids running around, I haven't had the time to check out your utilities much yet (or even work on my own league ideas much). I keep hearing they're great, so I'll have to see if I can make time.
__________________
THE VERY US ARTISTS - A project for musicians and visual artists

My music


Currently reading:
Thirteen by Richard Morgan


"When the trees blow back and forth, that's what makes the wind." - Steven Wright

Fjord emena pancreas thorax fornicate marmalade morpheme proteolysis smaxa cabana offal srue vitriol grope hallelujah lentils
ctorg is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:34 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 Out of the Park Developments