2009-11-23 25 views

回答

24
select * into x_temp from tbl where 1 = 0 
+1

這是一個很好的答案。 – MoonKnight 2012-01-18 17:34:18

2

這在大多數DBS:

create table blah as 
select * from foo where 1=0 

注意,這不會複製的PK,索引等

+0

此間接方向在SQL Server中不起作用。 – 2009-11-23 02:37:17

0
select top 0 * into temp_table from table 

這是我通常使用,但我喜歡邁克爾· B的方法也是如此。