0

Cloning table in SQL Server (help me pls)

Hi, how do i cloning a table in sql server? I used this query Create table newtablename as (select * from oldtable); But it's not working. Near the bracket, there is error stated "incorrect sysntax near '('. Expecting edge_type or filetable" Do i need to create a table first w 1 column, then insert the column from another table?

9th Sep 2021, 7:16 AM
Azfar Hafiz Ahmad
Azfar Hafiz Ahmad - avatar
1 Antwort
+ 2
CREATE TABLE newtable (LIKE oldtable); SELECT * INTO newtable FROM oldtable; Maybe this would help, note that you won't be able to copy indexes.
9th Sep 2021, 8:08 AM
Tim
Tim - avatar