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

bla*_*n91 2 database sql-server copy

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

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
Run Code Online (Sandbox Code Playgroud)

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

Msg 8101,Level 16,State 1,Line 3

只有在使用列列表且IDENTITY_INSERT为ON时,才能指定表'ms_tpl'中标识列的显式值.

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

更多信息:在数据库上ms_tpl,有一列调用id自动增量.

谢谢

jue*_*n d 6

只有在使用列列表 且IDENTITY_INSERT为ON 时,才能指定表'ms_tpl'中标识列的显式值.

不要用*.列出你的列:

INSERT into ms_tpl (col1, col2, ...) select col1, col2, ... from ...
Run Code Online (Sandbox Code Playgroud)