Sometimes you need a situation to quickly create a copy of an existing table in MSSQL Server. For example, you have a table named Person
and you need to copy it to a table named Person_1
in the same database. To do this, you need to use the SELECT INTO
construct:
SELECT * INTO dbo.Person_1 FROM dbo.Person;
This solution allows you to quickly copy the table. But you need to be careful because, with this method, columns and data are copied. But entities such as the index
will not be copied(in our case it is the Primary Key).