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:
It is useful table to generate and new table
Select Top 0 * into tblNew from tblOld
You just need to add one false condition. So that it wont return any data and you will create clone copy of table without data. you can use below query
Select * into Clone_Supplier from Supplier WHERE 1=2
Create Table new_table LIKE old_table
Will create an empty copy of original table with original attributes etc.