In this topic I show You how create table of the same structure as table in your database but empty.
It is very simple. You of course may use
CREATE TABLE statement, but it take You a lot of time, especially as You have a lot of columns. You may in this situation pay attention for datatypes and names columns.
My the way to resolve this problem is use
SELECT INTO statement and
TOP clause with
For example the table of
Person name from
AdventureWorks2012 database has 19 972 rows.
In the example below I create empty table of the same structure as
Person table from
SELECT TOP 0 * INTO [AdventureWorks2012].[Person].[NewPerson] FROM [AdventureWorks2012].[Person].[Person];
If You use
SELECT query You see empty new table.
SELECT * FROM [AdventureWorks2012].[Person].[NewPerson]