SQL Server: export data via SQL query?

Posted by rlb.usa on Stack Overflow See other posts from Stack Overflow or by rlb.usa
Published on 2010-05-07T20:32:29Z Indexed on 2010/05/07 20:38 UTC
Read the original article Hit count: 332

I have FK and PK all over my db and table data needs to be specified in a certain order or else I get FK/PK insertion errors. I'm tired of executing the wizard again and again to transfer data one table at a time.

In the SQL Server export data wizard there is an option to "Write a query to specify the data to transfer". I'd like to write the query myself and specify the correct order.

  1. Will this solve my problem?

  2. How do I do this? Can you provide a sample query (or link to one)

    • The databases are on two different servers - SQL Server 2008 on each ; The database names & permissions are the same ; each table name & col is the same ; I need Identity Insert for each table.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about data-export