views:

46

answers:

3

What is the best way to take a database and make it a flat file?

I am have an ODBC driver and need to pull the data out into a file file.

Excel, Access? OpenOffice?

+2  A: 

I'd suggest Excel as the fastest way to export data from any datasource that supports ODBC or OLEDB and write it out to a flat file.

alt text

The tools in Excel are helpful in shaping the query to the database.

Once you get it into Excel, you can then choose to Save As to .csv, .txt or transform it however you like.

p.campbell
I usually start with Excel. If it won't work, I move on to other tools/techniques.
Edward Leno
Note that Excel previous to 2007 had the limit of 65,536 rows (obviously, 2^16 limit), while A2007 and up up that to 2^20, or 1,048,576 rows. You will need to account for the number of rows in your export and the capabilities of the people you're sending it to. If you need more than the A2003 row limit, you'll need to be sure your recipients have A2007 or A2010. Delimited text files don't have any such limits.
David-W-Fenton
+1  A: 

If you want to set up relationships and to manipulate the data database-style, Access offers a range of import options, at least as many as Excel.

Remou
+1  A: 

As an alternative, you could run a SQL command from the database to create the csv file. This has the advantage of allowing you to use complex SELECT statements. Here is a simple example using MySQL:

select emp_id, emp_name from emps 
into outfile 'c:/test.txt';
Edward Leno