473,406 Members | 2,713 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,406 software developers and data experts.

Access SQL: exporting to CSV or TXT file

Hi there,

I was curious to know if there is a way to export a query to a csv or
txt file through SQL in access (like the SELECT INTO OUTFILE in mysql).
I have tried using this, but it does not seem to work.

Tim

Sep 29 '06 #1
4 17619
tr*****@gmail.com wrote:
>Hi there,

I was curious to know if there is a way to export a query to a csv or
txt file through SQL in access (like the SELECT INTO OUTFILE in mysql).
You sure can. Here's an example:

SELECT FieldName1, FieldName2, FieldName3 INTO [Text;HDR=YES;DATABASE=C:\Test\
].Results.txt
FROM TableName
WHERE (FieldName1 < 20);

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200609/1

Sep 29 '06 #2
I'm sorry. That got split up in the browser. The second and third lines of
text in the SQL should all be one line, with no spaces. It should read with
only four lines, not five. This is all one line:

[Text;HDR=YES;DATABASE=C:\Test\].Results.txt

--
Message posted via http://www.accessmonster.com

Sep 29 '06 #3
Thank you very much for the help! Is there any documentation regarding
the various options that can be used for the output file (i.e. HDR,
DATABASE etc.)?

Tim

Granny Spitz via AccessMonster.com wrote:
I'm sorry. That got split up in the browser. The second and third lines of
text in the SQL should all be one line, with no spaces. It should read with
only four lines, not five. This is all one line:

[Text;HDR=YES;DATABASE=C:\Test\].Results.txt

--
Message posted via http://www.accessmonster.com
Sep 29 '06 #4
tr*****@gmail.com wrote:
Is there any documentation regarding
the various options that can be used for the output file
Not specifically for SQL. I found *most* of what I needed in the Access 97
help files, but not in the newer versions. It was really hard to find, but
the topic was regarding connection strings to various file types, including
Excel spreadsheets, dBase files, Paradox, etc.

Here are some online examples of the syntax:

http://support.microsoft.com/kb/262537/en-us

http://support.microsoft.com/kb/326548/en-us

Documentation for text file formats:

http://msdn.microsoft.com/library/de...ext_format.asp
http://msdn.microsoft.com/library/de...a_ini_file.asp
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200609/1

Sep 29 '06 #5

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

Similar topics

1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
5
by: B1ackwater | last post by:
We've fooled around with Access a bit, but only using the single-user store-bought version. It seems to be a good database - versatile and infinitely programmable - and can apparently be used as a...
49
by: Mell via AccessMonster.com | last post by:
I created databases on Access 2003 and I want to deploy them to users. My code was also done using 2003. If they have Ms Access 2000 or higher, will they be able to use these dbs with all code,...
0
by: NewbieSupreme | last post by:
I'm using PHPMyAdmin on an Apache2Triad install (latest version; 5.x.x, which installs PHP5 and PHPMyAdmin 2.8 as well). In Access, I exported a table to a text file, tab-delimited, text qualifyer...
20
by: TC | last post by:
I need an automated procedure to copy data from an Access table to a SQL Server table. Speed is important. What is the recommended technique? I can export the data from Access, copy it via FTP,...
0
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign...
4
by: myemail.an | last post by:
Hi all, I use Access 2007 and have the following problems: when exporting banal select queries (either to Excel or to a csv file) I find that exporting often doesn't work and creates a file with...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
12
by: Mourad | last post by:
I need to attach (link) a table in SQL Server 2005 database to an Access 2.0 front-end database: On Access 2.0: Click File\Attach Table..., select <SQL Databaseclick OK On the "SQL Data...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.