Importing txt file (no delimited) into a database
-
Topic author - Site Admin
- Posts in topic: 4
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Importing txt file (no delimited) into a database
I need to get a rather large amount of data into a database. I'll probably use Access, but I could also use MySQL5 on one of the servers. I really would like to import this file, rather than entering the data manually for about 7700 records.
Here is my problem. The data is available only in a txt file and the file has no delimeters between the fields. Rather, each record is a fixed length of 196 bytes with specific data contained in specified blocks. For example, the full name (last, first, middle) is contained in "position" 1-31, address first line is in 32-63, city is in 64-84, etc. I know a delimited file (comma, tab) can be imported into a database, but can a file like I just described be imported into either Access or MySQL? If it matters, there are no characters acting as placeholders. If there is no data in a given area it's simply left blank.
Thanks,
Chas.
Here is my problem. The data is available only in a txt file and the file has no delimeters between the fields. Rather, each record is a fixed length of 196 bytes with specific data contained in specified blocks. For example, the full name (last, first, middle) is contained in "position" 1-31, address first line is in 32-63, city is in 64-84, etc. I know a delimited file (comma, tab) can be imported into a database, but can a file like I just described be imported into either Access or MySQL? If it matters, there are no characters acting as placeholders. If there is no data in a given area it's simply left blank.
Thanks,
Chas.
Re: Importing txt file (no delimited) into a database
perhaps you could use Excel.
open the .txt file in Excel. highlight column A (first column), then go to Data->Text to Columns.
choose the 'Fixed Width' option then hit 'next'. you will then be able to place the column borders where you want them, then finish and save as an excel sheet.
I don't use Access, but I'm guessing it should be fairly simple then to import the newly created excel sheet into a table.
open the .txt file in Excel. highlight column A (first column), then go to Data->Text to Columns.
choose the 'Fixed Width' option then hit 'next'. you will then be able to place the column borders where you want them, then finish and save as an excel sheet.
I don't use Access, but I'm guessing it should be fairly simple then to import the newly created excel sheet into a table.
-
- Senior Member
- Posts in topic: 1
- Posts: 766
- Joined: Fri Jun 01, 2007 11:27 am
- Location: Plano
- Contact:
Re: Importing txt file (no delimited) into a database
Actually, you can also do what fenster suggested directly into Access, and skip the Excel step. There's an option to import external data, and you can point it at your text file, specific that it's fixed with and define the field lengths and suck it all right into a new table.
-
Topic author - Site Admin
- Posts in topic: 4
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Re: Importing txt file (no delimited) into a database
That's great news! I'm working on the Excel method and it will work, but the txt file is about 2.5 times as large as the Excel 65,536 record limit. I was shocked to see it's that large! I thought I was going to have to import it in segments.Xander wrote:Actually, you can also do what fenster suggested directly into Access, and skip the Excel step. There's an option to import external data, and you can point it at your text file, specific that it's fixed with and define the field lengths and suck it all right into a new table.
Do you know if there is a record limit in Access?
Thanks,
Chas.
-
- Senior Member
- Posts in topic: 1
- Posts: 748
- Joined: Wed Nov 22, 2006 10:43 am
- Location: Grapevine, TX
Re: Importing txt file (no delimited) into a database
It's not a record limit you have to worry about, but a .MDB data file size limit of 2GB.Charles L. Cotton wrote:Do you know if there is a record limit in Access?
I use Access every day and haven't hit that limit yet. I've also imported quite a few files with over a million records.
-
Topic author - Site Admin
- Posts in topic: 4
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Re: Importing txt file (no delimited) into a database
I'll have about 160,000 records, so Access should work fine.hi-power wrote:It's not a record limit you have to worry about, but a .MDB data file size limit of 2GB.Charles L. Cotton wrote:Do you know if there is a record limit in Access?
I use Access every day and haven't hit that limit yet. I've also imported quite a few files with over a million records.
Thanks for your help guys!
Chas.
-
- Senior Member
- Posts in topic: 1
- Posts: 342
- Joined: Sun May 11, 2008 12:35 am
Re: Importing txt file (no delimited) into a database
Charles, I'm not sure what version of Excel you have, but the latest version of Excel supports up to 1 Million rows in a spreadsheet from the previous 65K.
-
- Senior Member
- Posts in topic: 1
- Posts: 6134
- Joined: Wed Jan 12, 2005 1:31 pm
- Location: Allen, TX
Re: Importing txt file (no delimited) into a database
If not importing directly into Access, which I haven't used in a couple of years so my recall is rusty, you could also take the .txt file into Word, and either create a table or add delimiters using find/replace.
Real gun control, carrying 24/7/365
-
Topic author - Site Admin
- Posts in topic: 4
- Posts: 17787
- Joined: Wed Dec 22, 2004 9:31 pm
- Location: Friendswood, TX
- Contact:
Re: Importing txt file (no delimited) into a database
I was able to import it into an Access database without any trouble.
Thanks,
Chas.
Thanks,
Chas.