Tahir Hassan's Blog

My Technical Notes

Wednesday, 30 January 2013

Creating a Duplicate Table for Testing Purposes

To create a duplicate table for testing purposes it is as simple as:


SELECT * INTO dbo.Customers2 FROM dbo.Customers


The above can be used with temporary tables:


SELECT * INTO #tmpCustomers FROM dbo.Customers


BUT it cannot be used to create a table variable.

To INSERT into an existing table, we should instead use INSERT INTO statement.