473,322 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

populating tables from text files

Hi there,

I'm not sure if SQL is capable of this so I would like your ideas and
comments.

I have over a thousand text files with in the below format.

[Win32_OperatingSystem]
ComputerName=computerHostName
OSName=Microsoft Windows XP Professional
OSVersion=5.1.2600
ServicePackMajorVersion=1
ServicePackMinorVersion=0
OSSerialNumber=bla bla bla
InstallDate=08/09/2004 15:53
LastBootUpTime=04/11/2004 09:10

[Win32_ComputerSystem]
Domain=mine.com
Manufacturer=Hewlett-Packard
Model=HP Compaq nc6000
TotalPhysicalMemory=1,023 MB

[Win32_Processor]
Count=1
CurrentClockSpeed=797

[Win32_BIOS]
SMBIOSVersion=68BDD Ver. F.0A
SerialNumber=Bla Bla Bla

[Win32_LogicalDisk (size in MB)]
Count=2
Size of C: drive=29,996
FreeSpace on C: drive=19,885
%FreeSpace on C: drive=66%
Size of D: drive=8,151

What i want to do is take each field from these text files and put them into
a MySQL table. Ignoring the lines with the headings in i.e [ignore]

Is there an sql statement i could use to readline from a text file and put
it into MySQL or is this something i would need to write a VB script for?

Also the second problem comes once it has finished one text file i want it
to move onto the next text file in the folder. As i say this folder
contains over 2 thousand text files and I will want to run this script at
least once a week to update the tables.

Any ideas would be greatly appreciated.

Thanks in advance
--

Jamie Allison
Sheffield Hallam University
Software Engineering
Final Year
Jul 23 '05 #1
2 2159
Jamie wrote:
What i want to do is take each field from these text files and put them into
a MySQL table. Ignoring the lines with the headings in i.e [ignore]

Is there an sql statement i could use to readline from a text file and put
it into MySQL or is this something i would need to write a VB script for?


I would do this in some application code, and VB should be just fine for
that (other languages would be fine too). I can't think of a
straightforward way to do this purely in SQL.

Also, these problems have a tendency to expand: next you'll be parsing
other types of files, or the files will have new kinds of syntax within
them. Writing a script or a series of scripts is a better way to
accommodate changing requirements, since a SQL solution would be more
complex and more difficult to alter.

Regards,
Bill K.
Jul 23 '05 #2
>Jamie wrote:
What i want to do is take each field from these text files and put them into
a MySQL table. Ignoring the lines with the headings in i.e [ignore]

Is there an sql statement i could use to readline from a text file and put
it into MySQL or is this something i would need to write a VB script for?


If you're looking at a one-time import, and don't mind a kludge, you can use an
app (maybe Excel / OpenOffice) ? to export the HTML table to CSV, and then
import that file into MySQL. It's certainly not a programmatic solution, nor
one to be proud of, but it'll get the job done fairly quickly. <g>

Other ideas are available via Google :
http://www.google.com/search?num=25&...SV&btnG=Search
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: amber | last post by:
I've been trying to figure out how to get 2 datasets to populate a report/subreport - and I think I'm on the right track...just having a few problems somewhere... I have created a dataset (.xsd)...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
1
by: Jeremy | last post by:
Hi, I hope (expect!) this is straightforward - at this stage I need to know the feasibility of this. The scenario: a webserver running a database. A subset of the data (say 3 tables) needs to be...
2
by: GUEST | last post by:
can anyone tell me if its possible to create tables and populate tables using a script via notepad ? cheers -- reply to newsgroupsurferATyahooDOTcom
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
0
by: teju | last post by:
Hi all, I am trying to populate tree view from the database. Till two levels i can populate it fine but when it reaches third level it doesn't expand. Below is the code, it has been taken from the...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
0
by: Bomac8 | last post by:
I have a text file with "|" as a delimeter with three (3) fields XXX-12345|\\YYYYYYY|\\ZZZZZZZZ I need to read these files into an output folder. The problem that I'm having is that I need to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.