已经有一个名为“tbltable1”的对象; 在数据库中

发布于 2024-07-27 21:28:26 字数 210 浏览 2 评论 0原文

我试图将数据从一个表插入到具有相同结构的另一个表中,

select * into tbltable1 from tbltable1_Link

但收到以下错误消息:

There is already an object named 'tbltable1' in the database.

I am trying to insert data from one table to another with same structure,

select * into tbltable1 from tbltable1_Link

I am getting the following error message:

There is already an object named 'tbltable1' in the database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰魂雪魄 2024-08-03 21:28:26

SELECT INTO 语句创建一个名为您的新表提供并用 SELECT 语句的结果填充它。

我认为您应该使用 INSERT INTO 因为该表已经存在。 如果您的目的实际上是填充临时表,那么您应该提供数据库中尚不存在的表名。

有关详细信息,请参阅 MSDN

The SELECT INTO statement creates a new table of the name you provide and populates it with the results of the SELECT statement.

I think you should be using INSERT INTO since the table already exists. If your purpose is in fact to populate a temporary table, then you should provide a table name that does not already exist in the database.

See MSDN for more information on this.

风苍溪 2024-08-03 21:28:26

如果您确信不需要 tbltable1,则可以先删除该表。

您可能还想考虑使用临时表...

Select * into ##MyTemporaryTable FROM tblTable1_Link 

然后您可以在此会话中使用临时表。 (如果我没记错的话,结束会话应该会自动删除临时表。自从我使用 SQL Server 以来已经有一段时间了)。

If you are confident that tbltable1 is not required, you can drop the table first.

You may also want to consider using temporary tables...

Select * into ##MyTemporaryTable FROM tblTable1_Link 

You can then use the temporary table in this session. (Ending the session should drop the temporary table automatically, if I remember correctly. It's been a while since I've worked with SQL Server).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文