gpt4 book ai didi

sql-server - 无法将行从一个数据库复制到 SQL Server 上不同服务器上的另一个数据库

转载 作者:搜寻专家 更新时间:2023-10-30 20:02:32 25 4
gpt4 key购买 nike

我试图将一行从一个数据库复制到不同服务器上的另一个数据库,这里是查询:

set identity_insert ms_tpl on

INSERT ms_tpl select * from [10.24.0.2].[MILKP].[dbo].[ms_tpl] where [id] = 3076

set identity_insert ms_tpl off

当我按 F5 时,我收到如下错误消息:

Msg 8101, Level 16, State 1, Line 3

An explicit value for the identity column in table 'ms_tpl' can only be specified when a column list is used and IDENTITY_INSERT is ON.

我的查询有误吗?如何解决这个问题?

更多信息:在数据库 ms_tpl 上,有一列名为 id 的自动递增。

谢谢

最佳答案

An explicit value for the identity column in table 'ms_tpl' can only be specified when a column list is used and IDENTITY_INSERT is ON.

不要使用*。列出您的专栏:

INSERT into ms_tpl (col1, col2, ...) select col1, col2, ... from ...

关于sql-server - 无法将行从一个数据库复制到 SQL Server 上不同服务器上的另一个数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10681686/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com