简体   繁体   English

107095:在Microsoft SQL Server中批量插入时出错:必须在Insert Bulk语句中指定表的所有列

[英]107095 : Error while Bulk insert in Microsoft SQL Server : All columns of the table must be specified in the Insert Bulk statement

Error while Bulk insert in Microsoft SQL Server : SQL State : 37000, Native error = 1070905 All columns of the table must be specified in the Insert Bulk statement Getting this error in one of our application which has the loader script. 在Microsoft SQL Server中批量插入时发生错误:SQL状态:37000,本机错误= 1070905必须在Insert Bulk语句中指定表的所有列。在具有加载程序脚本的我们的一个应用程序中获取此错误。 Could anyone please explain what this error means and what are the reasons for this occurrence and solution. 任何人都可以解释该错误的含义以及发生此错误的原因和解决方案。

The syntax diagram gives a hint on how to solve this: 语法图提示如何解决此问题:

BULK INSERT [ database_name . 批量插入[database_name。 [ schema_name ] . [schema_name]。 | | schema_name . schema_name。 ] [ table_name | ] [table_name | view_name ] view_name]
FROM 'data_file' 来自“ data_file”

The key idea is view_name . 关键思想是view_name

Define a view that selects only the columns you want to import. 定义仅选择要导入的列的视图。 Then use that for the bulk insert . 然后将其用于bulk insert

I use this to set default values (as as identity columns) when importing data. 导入数据时,我用它来设置默认值(作为标识列)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM