Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Exporting Distinct Records

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2003-06-12 : 09:37:07
I have a data duplication problem and want to export only distinct records of 42 tables to a different shared sql server.

Is there a way to export data from multiple tables and only copy distinct records? I know that I can do this using a query option and inserting the Distinct phrase into the query. But this seems laborious as only one can be done at a time and there are 42 tables that need to be exported.

Any ideas would be greatly appreciated. Thanks in advance!


mr_mist
Grunnio

1870 Posts

Posted - 2003-06-12 : 10:05:25
You could possibly get around it by setting up a table with all the fields as a clustered index with the ignore duplicate keys option on, so it ignores the rows when you insert them.

But to be honest you may as well type the select distinct queries this time, and learn not to do it again :D

-------
Moo.
Go to Top of Page

RichardSteele
Posting Yak Master

160 Posts

Posted - 2003-06-12 : 10:18:28
Thanks for your insight.

Here's my other problem. I need to do this off hours and thus ideally this would be set up in a DTS package.

If I use a separate Query statement for the export of each table, can each of those exports be appended to just one DTS package? I don't see that option when I'm exporting a table.

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-06-12 : 10:45:55
Just use a new transform data task for each table you want to export. ?

-------
Moo.
Go to Top of Page

RichardSteele
Posting Yak Master

160 Posts

Posted - 2003-06-12 : 12:26:25
Thanks for your input. If I understand you correctly, there is no way to append more individual tasks to one DTS package through the Import/Export module of Enterprise Manager.

I'll need to create a different DTS package for each of my 42 tables-- each one will include a single query. Is this correct?

Go to Top of Page
   

- Advertisement -