CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
The first two examples show you how to use queries to import and export text to and from the sample database Northwind.mdb. To set up an example, create a new query (do not add any tables), click the
SQL button, and type the corresponding SQL statement. Then, to import or export, just run the query. The third example shows you how to export a table in Unicode format.
Example 1
The following SQL code shows you how to export a table to a text file:
SELECT * INTO
[Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].[OutCustomers#txt]
FROM Customers;
Example 2
The following SQL code shows you how to import a table from a text file (this is the one created in the first example):
SELECT * INTO ImpCustomers
FROM [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].[OutCustomers#txt];
Example 3
To modify the SQL statement so that it exports the data in Unicode text format, add the following option to the
connection argument:
For example, you can modify the statement in Example 1 to the following:
SELECT * INTO
[Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;CharacterSet=Unicode].[OutCustomersUNI#txt]
FROM Customers;