导入平面文件“ Microsoft.SqlServer.Prose.Import”时出错

时间:2019-03-23 20:06:49

标签: sql sql-server sql-import-wizard

将平面文件插入SQL Server时出现错误。无法从SQL Server直接传输到SQL Server。数据必须先导出然后再导入。注意:数据是从SQL Server导出的,带有文本限定符“双引号”和管道分隔符“ |”。我试图使用仍然无法导入的固定宽度格式重新提取数据。请协助。

错误消息:

将数据插入表时出错。 (Microsoft.SqlServer.Import.Wizard)

------------------------------
Program Location:



 at Microsoft.SqlServer.Import.Wizard.InsertData.ResultCheck(Result result)
   at Microsoft.SqlServer.Import.Wizard.InsertData.DoWork()
   at Microsoft.SqlServer.Management.TaskForms.SimpleWorkItem.Run()

===================================

Error inserting data into table. (Microsoft.SqlServer.Prose.Import)

------------------------------
Program Location:

   at Microsoft.SqlServer.Prose.Import.BcpSynthesis.InsertIntoDB(String inputFilePath, String tableName, String schemaName, SqlConnection connection, Int32 batchSize, SqlTransaction transaction)
   at Microsoft.SqlServer.Prose.Import.BcpProcess.<>c__DisplayClass42_0.<InsertIntoDb>b__0()
   at Microsoft.SqlServer.Prose.Import.BcpProcess.ExecuteOperation(Action operation)

===================================

Object reference not set to an instance of an object. (Microsoft.SqlServer.Prose.Import)

------------------------------
Program Location:

   at Microsoft.SqlServer.Prose.Import.OutputDataReader.GetValue(Int32 i)
   at System.Data.SqlClient.SqlBulkCopy.GetValueFromSourceRow(Int32 destRowIndex, Boolean& isSqlType, Boolean& isDataFeed, Boolean& isNull)
   at System.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col)
   at System.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource`1 source)
   at System.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource`1 source)
   at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
   at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
   at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source)
   at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source)
   at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
   at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
   at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader)
   at Microsoft.SqlServer.Prose.Import.BcpSynthesis.InsertIntoDB(String inputFilePath, String tableName, String schemaName, SqlConnection connection, Int32 batchSize, SqlTransaction transaction)

0 个答案:

没有答案