已经有一个名为“tbltable1”的对象; 在数据库中
我试图将数据从一个表插入到具有相同结构的另一个表中,
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.
如果您确信不需要
tbltable1
,则可以先删除该表。您可能还想考虑使用临时表...
然后您可以在此会话中使用临时表。 (如果我没记错的话,结束会话应该会自动删除临时表。自从我使用 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...
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).