How can I create clone copy of table without data? Because I just want to copy a definition of table not data.
I tried below but it is copying data as well
Select *
into Clone_Supplier
from Supplier
How can I create clone copy of table without data? Because I just want to copy a definition of table not data.
I tried below but it is copying data as well
Select *
into Clone_Supplier
from Supplier
Copy all columns from selected table
Select Top 0 * into NewTable from OldTable
Copy some columns from selected table
Select Top 0 Col1,Col2 into NewTable from OldTable
Copy all(Data and Structure)
Select * into NewTable from OldTable
You could add WHERE 1=2 to get structure only:
Select *
into Clone_Supplier
from Supplier
where 1=2;
It won't be exact copy though:
SELECT ... INTO does copy IDENTITYIDENTITY(int,1,1) like in DEMOIt is useful table to generate and new table
Select Top 0 * into tblNew from tblOld
Create Table new_table LIKE old_table
Will create an empty copy of original table with original attributes etc.