N/APosted on - 01/13/2015
Hi! I need to copy table with a lot of columns in SQL Database (mdf file), only structure without data and assign a new name to it. New table will have the same amount of columns only 2 of them will have different data types. Connected my database to SQL Server Management Tools but couldn't find an option of copying it. Please help.
How to copy tables in SQL Server
You can uses SELECT INTO statement for copy data from one table to another. And you can insert into the new table.
SELECT INTO STATEMENT
SQL SELECT INTO Syntax
You can copy columns in the new tables.
INTO newtable [IN externaldb]
If you want to data one table to another then use this code.
SELECT empname.empnameName, Orders.OrderID
LEFT JOIN Orders
The select into statement used for following:-
1. Create new table
2. Empty table
3. If you want return with no data then add WHERE. ex:-