how can i create a copy of table with data, indexes and constraints

  • hi ,

    i have atble named emp which contains an index on empno and a constraint on address columns.

    when i use the following query

    select * into emp_copy from emp.

    here i will get the data and structure of table.

    how can i get the constraints and indexes along with the data and structure???

    please help me

  • Hi,

    Using Select into option, the indexes and constraints are ignored. Generate the script of the table by selecting options to include constraints, indexes (right click on tables--> all tasks--> Generate Script).

    Run this script to create another table (emp2).

    Insert into emp2

    select * from emp

    [font="Verdana"]Renuka__[/font]

  • i always use SSIS, just set CopySchema to true and select all the constraints, etc you want to copy over

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply