How to Write a Query to Specify the Data to Transfer in the Import Wizard

laptop with database record on 15.4" wide screen image by .shock from

Importing data to your database is accomplished using the structured query language (SQL). Using an SQL query, you can filter the results retrieved from one database before importing it to another. Creating the query to import your records is similar to creating a query to retrieve and view records. The SQL query language makes it simple to import records and filter out unwanted table rows.

Create a simple select statement. The select statement retrieves records for the import wizard. The following example retrieves records from a customer table:

select * from customer

Filter the records you want to retrieve. The "where" clause filters records from the list, so the import wizard only sets up the required records. The following code retrieves only the customers whose last name is "Smith":

select * from customer where last_name='smith'

Filter the columns imported. If your table is large, you may only want required table columns. The asterisk symbol retrieves all columns from the table. You can limit the columns for the import wizard by specifying each column to import. The following code only retrieves the first and last name from the table:

select first_name, last_name from customer where last_name='Smith'

Copy and paste the query to your import wizard. You can also test the query by pressing the F5 key to execute it and view the returned records.

Most recent