在sqlserver中
select col1,col2,col3 into newtable from mytable
就会生成,一个结构一样且带数据的表
如果不要数据
select col1,col2,col3 into newtable from mytable where 1=0
select col1,col2,col3 into newtable from mytable
就会生成,一个结构一样且带数据的表
如果不要数据
select col1,col2,col3 into newtable from mytable where 1=0
是的话不如这句呢,刚找到的:select * into newtable from oldtable
create table newtable as select * from oldtable;这样做出来的表结构是一样,但是所有的trigger/constraint都不会带过来,还不是完全一样的。
在查询分析器,中执行即可