English 中文(简体)
在 SQL 服务器上的不同服务器上, 无法从一个数据库复制一个行到另一个数据库
原标题:Can t copy a row from one database to another database on different server on SQL Server

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

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时,我收到这样的错误信息:

8101Mg,16级,州一级,第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 的列,有自动递增。

感谢 谢谢

最佳回答

表格 ms_tpl 中身份列的清晰值只能在使用列列表 和 IDentiity_INSERT 时指定为 < 强 > 。

不要使用 。列出您的列 :

INSERT into ms_tpl (col1, col2, ...) select col1, col2, ... from ...
问题回答

在插入语句中添加列列表

INSERT ms_tpl column1, column2, ...

这将解决问题





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...