0

Trying to create partition for existing tables in a database. I was thinking to have SSIS to

  1. Script out table generation script for a table
  2. Modify the script to replace name etc to create new table
  3. Transfer data from the original table to the new table being created
  4. Rename the original table to another name
  5. Rename the new table as original table

Is it possible?

Tom
  • 371
  • 2
  • 6
  • 15

1 Answers1

0

1,2,3 all done with SELECT INTO

4,5 EXEC sp_rename 'old_table_name', 'new_table_name'

Select INTO will not move indexes.

KeithL
  • 5,348
  • 3
  • 19
  • 25
  • I need to retrieve DDL including keys and indexes not just data. Is there a way? – Tom Apr 25 '20 at 15:15
  • try this as a start then https://stackoverflow.com/questions/6215459/t-sql-query-to-show-table-definition – KeithL Apr 25 '20 at 18:29