MS SQL Data Wizard online Help
Prev | Return to chapter overview | Next |
Adding objects to export data from
To specify source database objects you want to export data from, click the Add... button and pick the objects in the Select objects dialog. To choose several objects at a time, select them using Ctrl and Shift keys, then click Mark selected.
To use a custom SQL query as a data source, use the Create query button and enter the query name and a SELECT statement. It is also possible to load a query from an .sql file.
Rules for creating queries used by Data Export
All queries must satisfy the simple requirement: the following query must be correct.
select * from
(
QUERY_TEXT_YOU_ENTERED
) an_alias
This happens because the software uses similar queries for internal needs. In case such SQL expression is not valid, the wizard marks the query as invalid and displays its name in red.
To meet this requirement, make sure that all the columns in the result dataset have unique aliases. For example, the following query works fine itself, but returns a dataset with two columns named id:
SELECT
table1.*,
table2.*
FROM table1, table2
WHERE table1.id = table2.id;
This is the reason the wizard marks this query as invalid. To solve the problem, provide these columns with unique aliases:
SELECT
table1.id as table1_id,
table2.id as table2_id
FROM table1, table2
WHERE table1.id = table2.id;
Prev | Return to chapter overview | Next |