?
Solved

Script to append txt file daily to a ODBC Database

Posted on 2011-03-20
5
Medium Priority
?
413 Views
Last Modified: 2012-08-13
I have a txt file that I want to export/append to a ODBC Database on a daily basis, Would I need software that needs to do this or can a script be run to do so ?

Below is an example of what the file format looks like every day parc2.txt
0
Comment
Question by:John-S Pretorius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 180 total points
ID: 35179055
Use VBScript to connect to your ODBC database, read txt file, create and execute insert statements...

creating an odbc connection using vbscript
http://www.visualbasicscript.com/creating-an-odbc-connection-using-vbscript-m54220.aspx
0
 
LVL 8

Accepted Solution

by:
GundogTrainer earned 195 total points
ID: 35179235
Can you state the backend database type - I know you have stated it is ODBC compliant but if its an MSSQL instance you can use the BCP utility to "Bulk Copy" a text file into a database.
(There are other tools for other databases vendors)

Microsoft details for the utility are here: http://msdn.microsoft.com/en-us/library/aa174646(v=sql.80).aspx

So for example to import park2.txt into a table called CarparkTemp in SQL Server SQL-SVR-1 would be
bcp dbo.CarparkTemp in park2.txt /SSQL-SVR-1 /UsqlimportUser -Ppassword

You may need to create a format file (fmt) to define your data types but it may be easier than developing your own vbscript to perform the import for you.
0
 

Author Comment

by:John-S Pretorius
ID: 35179339
Thank you, I believe that this puts me on the right track. I have sql express installed, will this work? as I'm trying to accumulate raw data for later access by a crystal report. I can also use access or Excel to accumulate/append data.
0
 

Author Comment

by:John-S Pretorius
ID: 35179341
Thank you, I believe that this puts me on the right track. I have sql express installed, will this work? as I'm trying to accumulate raw data for later access by a crystal report. I can also use access or Excel to accumulate/append data.
0
 

Author Closing Comment

by:John-S Pretorius
ID: 35232516
Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question