Quickly Duplicate Table Structure

Here is a quick way to create a table that has the same structure as an existing table (without listing the entire CREATE TABLE syntax of the other table).

Just run the query...

SELECT * INTO [new table] FROM [old table] WHERE (1 = 0)

You can even use it in a stored stored procedure to create a temp table

select * into #temp from [my table] where 1 = 0

Source: Terri Morton, [aspsqlserver2000]
Viewed 8909 times