Monday, October 19, 2009

Create a Duplicate table

There are often times when I want to create a duplicate structure of an existing table. The simplest way to do that is following:

SELECT TOP 0 * INTO dbo.tablename
Remember to put a dbo before the new tablename, or else SQL Server creates the table under your schema.

No comments:

Post a Comment