Tuesday, March 27, 2012

Dts Export

I am trying to export all the records from 6 different tables from sql server to a text file using the DTS wizard. I want all the info of the first table to appear first, then all the info of the second table, etc.
Any ideas on how to do this type of query?
thanks in advance.Quote
"I am trying to export all the registries from 6 different tables"

what do you mean by registries?|||I think I made the wrong translation...

I ment all the data in each table|||How about
Select 1 as 'Sort' , T1.* from table1 T1
Union
Select 2 as 'Sort' , T2.* from table1 T2
.
.
.
.

order by sort

??|||I get the following error trying to use the UNION operator:

"All queries in an SQL statement containing a UNION operator must have an equal number of expressions in their target lists."

The number and the order of the columns are not identical in all queries...

No comments:

Post a Comment