Extracting data from an ODBC source to text


I need to extract data automatically on schedule (perhaps with a batch file) from an ODBC source using a query, SELECT DISTINCT field1,field2 FROM tablename, etc and dump this in a text file with a record on each line. Any suggestions?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There are a few options. What kind of data Is the ODBC source pointing at?
If the ODBC data source is pointing at a SQL Server then you can use the BCP command line tool to export data directly, assuming you have SQL Server tools installed.
If its not SQL Server, then you may be able to download a database specific tool to do it for you. You could also use VBScript and ADO to connect to the data source and export the text file (this does not require you to install anything special and should work against any ODBC source)
All of these options are command line driven so you can use whatever scheduler you want to run them.
Post back what database the ODBC source is pointing at.
jlsergeantAuthor Commented:
The source data resides within the 'sage Timberline' application. (Beyond this i'm unsure, perhaps btrieve. but i really don't know)

It has an ODBC driver and I would like to extract automatically via this driver. Currently I can extract manually using 3rd party tools. If you have any script source it would be greatly appreciated.
The concept is to write a VBScript which uses ADO to connect to the ODBC data source, retrieves the dataset and writes it to a file.
I don't have a script on me. I may be able to cook one up before I leave work in about 20 minutes.
I've heard that the timberline ODBC driver can be a bit dodgy though.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Sorry.. VBScript is very handy but a real pain to debug. I'll get back to it on Monday.
Bill BachPresident and Btrieve GuruCommented:
There are several available tools that allow for simple extraction.  If you just want to script it from a command line, then try SQLExec, a tool from Goldstar Software (who also provides Pervasive database support for Timberline and other similar environments).  SQLExec offers a number of export options, and while writtenoriginally for Pervasive databases, it will work on just about any valid ODBC data environment.  You may find other similar tools available on the 'Net as well.

If you are integrating Timberline with other environments, then you may wish to look at the entire class of ETL (extract/transform/load) tools, such as Pervasive's Data Integrator or open-source solutions from Jaspersoft or Pentaho.  These tools allow you to extract data, manipulate it as needed, and send it into another environment quite easily.  Many come with schedulers for repeat-processing, too, and can even watch for other "trigger" data, such as files appearing in a directory or FTP site.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jlsergeantAuthor Commented:
Thanks guys, I'm going to buy SQLEXEC. It does everything required.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.