I am using this query:
SELECT *
INTO table1
FROM table2
To copy a table; it doesn't copy the primary key from table2
to table1
as Primary key. It just copies all columns - not constraints.
I am using this query:
SELECT *
INTO table1
FROM table2
To copy a table; it doesn't copy the primary key from table2
to table1
as Primary key. It just copies all columns - not constraints.
As per my knowledge In SQL server it's not possible your requirement but in case you need same structure with primary key first generate script for existing table then create new table.
using ssms->object explorer->expand databases->select database->right click on table and generate script