从现有表创建表(结构) [英] Create table (structure) from existing table

查看:31
本文介绍了从现有表创建表(结构)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建与另一个表结构相同的新表

How to create new table which structure should be same as another table

我试过了

CREATE TABLE dom AS SELECT * FROM dom1 WHERE 1=2

但发生了不工作的错误

推荐答案

尝试:

Select * Into <DestinationTableName> From <SourceTableName> Where 1 = 2

请注意,这不会复制索引、键等.

Note that this will not copy indexes, keys, etc.

如果要复制整个结构,则需要生成表的创建脚本.您可以使用该脚本创建具有相同结构的新表.如果需要,您还可以将数据转储到新表中.

If you want to copy the entire structure, you need to generate a Create Script of the table. You can use that script to create a new table with the same structure. You can then also dump the data into the new table if you need to.

如果您使用的是企业管理器,只需右键单击该表并选择复制以生成创建脚本.

If you are using Enterprise Manager, just right-click the table and select copy to generate a Create Script.

这篇关于从现有表创建表(结构)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆