Sql-server – Copying Partitioned table data to another table on different SQL Server

bcpexportpartitioningsql-server-2012

We have a partition table on Production environment with 2338117620 rows and 206 partitions. Now we have to copy only last 2 year data in Test environment.

But the problem is that , Import Export utility does not copy partition tables the same way in target database even if we have created the same partition reference on the target database.

So, now we have only one option left is that of Bulk-copy. But not sure if
bulk copy supports exporting partition data to a target partitioned table.
Do let me know your thoughts on it.

Best Answer

BCP works fine.

  • First, you create the target table.
  • Then export data with the select and filter you need.
  • Import data with BCP will fit the correct partitions.

I did this before. I was on SQL 2014, but it will be fine on 2012.