Sql server 如何在不使用create的情况下将sql server中的表内容移动到另一个表中
我正在尝试使用表中的Sql server 如何在不使用create的情况下将sql server中的表内容移动到另一个表中,sql-server,Sql Server,我正在尝试使用表中的select*from您可以使用select。进入: I'm trying to move a table in sql server to another table without the use of create. Is there any way to accomplish this. 选择s.* 进入 从s; 这将创建带有自动填充数据的表格 注意:这将复制表定义,仅包括(列/数据类型) SELECT INTO语句创建一个新表,并将查询中的行插入其中。 有关更多
select*from
您可以使用select。进入
:
I'm trying to move a table in sql server to another table without the use of create. Is there any way to accomplish this.
选择s.*
进入
从s;
这将创建带有自动填充数据的
表格
注意:这将复制表定义,仅包括(列/数据类型) SELECT INTO语句创建一个新表,并将查询中的行插入其中。 有关更多信息,请参阅
SELECT s.*
INTO <destination>
FROM <source> s;
使用简单的插入查询
SELECT
select_list
INTO
destination
FROM
source
[WHERE condition]
插入目标(列)
挑选*
来源
哪里
如果需要,请删除现有记录
从源代码中删除
哪里
犯罪
请记住,创建此新表需要目标数据库中的“创建表”权限。另外,如果新表已经存在,将抛出异常。@Pepelui360。这是OP应该知道的最基本的事情。“移动”和“复制”意味着非常不同的事情。
insert into destination(columns)
select *
from source
where<condition>;
delete from source
where <condition>
commit;