![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a flat text file that is an exported data dump. It unfortunately has 5 tables inside of it and no way to modify the how the data is given to me. Each different table starts with an "!" and the table name. Comment lines are ";" and data is delimited with ":" For example data would look like this: ![ExportedTime]01/01/2006 22:22 ; ; Terminal export data ; !General Revision = 1 CurrentStatus = 1 ExpectNewData = 15 ; !Customer: ID:JamesClark:StreetAddy:City:State:Zip:Phone1:Pho ne2: ; !Transaction: ID:Customer ate:TransValue:; !Employee: ID:Name:Login:Logoff:Terminal: ; ; END I would need to get each section into its own table ie. General into General and Customer into Customer. Note the General section has a different export format as well, but would go into one data row. The length of each section/table would vary, and the old table would have to be cleared before each import ~ every 15 minutes. I don't need the comment lines at all. Is there a simple way to do this? Thanks... |
#3
| |||
| |||
|
|
Simple . . . maybe not but it is possible. If it were me I would do it all in an ActiveX script using the File System Object to read each line of the file one at a time and called a stored proc to insert each row. You would have to check inside your look for the character that denotes a new table and change your stored proc call occordinly. It would probably take a couple hours to code and test if you're familiar with vbscript, the FSO and ADO (command objects, connection objects, etc.) Below is an example of using ADO to called procs and using the File system object: |
#4
| |||
| |||
|
|
Walter, thanks... I think it makes sense but I'm not upto speed in ActiveX scripting. Is there a good reference manual out there. It's been years since I've coded. "Walter Mallon" wrote: Simple . . . maybe not but it is possible. If it were me I would do it all in an ActiveX script using the File System Object to read each line of the file one at a time and called a stored proc to insert each row. You would have to check inside your look for the character that denotes a new table and change your stored proc call occordinly. It would probably take a couple hours to code and test if you're familiar with vbscript, the FSO and ADO (command objects, connection objects, etc.) Below is an example of using ADO to called procs and using the File system object: |
#5
| |||
| |||
|
|
Walter, thanks... I think it makes sense but I'm not upto speed in ActiveX scripting. Is there a good reference manual out there. It's been years since I've coded. "Walter Mallon" wrote: Simple . . . maybe not but it is possible. If it were me I would do it all in an ActiveX script using the File System Object to read each line of the file one at a time and called a stored proc to insert each row. You would have to check inside your look for the character that denotes a new table and change your stored proc call occordinly. It would probably take a couple hours to code and test if you're familiar with vbscript, the FSO and ADO (command objects, connection objects, etc.) Below is an example of using ADO to called procs and using the File system object: |
#6
| |||
| |||
|
|
Here's another vbscript. This one parses an IIS log file and imports it into the database. I actually used the Windows AT scheduler for this one. Hope this helps. Walter |
![]() |
| Thread Tools | |
| Display Modes | |
| |