复制表结构创建新表

来源:互联网 发布:网络推广成功案例 编辑:程序博客网 时间:2024/04/27 16:40

select top 0 * into (要创建的表名)from 复制的表名

 

select top 0 * into t_apps123 from dbo.t_survey_results   --此写法不能创建主键

 

-- 和上面的类似,可以创建主键

select * into CG from t_survey_results
where 1<>1 alter table CG
add constraint
PK_EXPORT_BA primary key (result_id)

原创粉丝点击