English 中文(简体)
平均错误信息 服务器大体
原标题:verbose error information for SQL Server bulk insert

Im使用服务器快车2008年,Im用散装填数据。 我愿有更精确的错误信息,最好是印刷未插入的数据。 这是可能的吗?

最佳回答

这样做是可能的,但可能需要作出大量努力,在我去做所需要做的一切之前几天内,让我记得在子系统工作。 我认为,这是在错失时将2(2)条错误信息退回到后,2条错误信息是模糊的,没有别的;all,错误处理功能只能获取与第二个主题信息相关的信息,而不是真实信息的第一个信息。 我没有在我前面的法典,但逻辑是:

  • Use the "errorfile" option on BULK INSERT to generate an error file IF the bulk insert fails
  • TRY/CATCH the bulk insert call, and carefully check the returned error number
  • If the error is the appropriate type, open and read the contents of the file to determine what went wrong where, and build your error message around that

不管怎么说,但最终效果好。 只要驱动器+path+filename,你就从斜线上插入128个特性(在2005年,在我刚好在座,在2008年,他们打上了固定标记)。 我不赞成将Bulk插入我喜欢的指挥。

问题回答

暂无回答




相关问题
How to write this T-SQL WHERE condition?

I ve got two tables: TableA Col1 Col2 TableB Col3 Col4 I want to join them together: SELECT * from TableA join TableB ON (...) Now, in place of ... I need to write an expression ...

Customer and Order Sql Statement

TSQL query to select all records from Customer that has an Order and also select all records from customer that does not have an Order. The table Customer contains a primary key of CustomerID. The ...

Recommended way of querying multiple Versioned tables

Have a win 2003 box with MSSQL 2005 running on it. There is a database which is populated every morning with new/modified SalesOrder made the previous day. The database has several tables: SalesOrder, ...

update duplicate record

I have a table with the following fields Id Name IsPublic i need to write a sql query that updates IsPublic to false where name has a duplicate. Only one of the duplicates should have IsPublic = ...

Define variable to use with IN operator (T-SQL)

I have a Transact-SQL query that uses the IN operator. Something like this: select * from myTable where myColumn in (1,2,3,4) Is there a way to define a variable to hold the entire list "(1,2,3,4)"? ...

Selecting records during recursive stored procedure

I ve got a content management system that contains a hierarchical structure of categories, with sub-categories subject to different ordering options at each level. Currently, that s retrieved by a (...

热门标签