In this article we are going to how to copy an existing table to new table in
with an example.
SQL Server (Transact-SQL) SELECT INTO statement is used to create a new table from an existing table by copying the existing table's schema and data. It is important to note that when creating a table in this way, the new table will be populated with the records from the existing table (based on the SELECT Statement).
Let’s see simple an example of SELECT INTO statement
SELECT INTO statement
SELECT * INTO NEW_CUSTOMER from CUSTOMER
In above example, we have a customer table, which is copied customer table data and schema to the new Customer table.
I hope it will help you after reading it.
you might also like to read next topic how to import excel data in
sql server database ,
use Cursor in SQL server, subquery in
how to create Table-valued functions in SQL