SQL Capture BULK INSERT错误4863 [英] SQL Capture BULK INSERT error 4863

查看:142
本文介绍了SQL Capture BULK INSERT错误4863的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  BEGIN TRY 
BULK INSERT dbo.EQUIP_STATUS_CODE
FROM'filepath\filename.csv'
WITH(MAXERRORS = 1,FIELDTERMINATOR =',')
END TRY
BEGIN CATCH
EXECUTE dbo.ERROR_LOG_CSV;
END CATCH

发生以下错误时,我想要捕获以下错误:


批量加载数据转换错误(截断)


但是,似乎我不能,即使这个级别是16,它落在了try-catch范围内。我想知道有没有办法在发生错误时捕获此错误。



在我指定 MAXERRORS 之前1我得到这个错误:


无法从链接服务器(null)的OLE DB提供程序BULK中获取一行。 p>

由于前一个错误对于问题的描述更多,那就是我想要记录的那个。

解决方案

尽管我的能力比SQL Server还要多,但无论如何,我将尽力帮助解决这个问题。我发现你的情况已经在SQL Server的bugtracker(bug id:592960),状态Will not fixsince 2010.你可以看到相关的讨论在 connect.microsoft.com 你自己(目前主持人是无法访问的,所以我使用 google cache )。


I have a bulk insert inside a try - catch block:

BEGIN TRY
    BULK INSERT dbo.EQUIP_STATUS_CODE
    FROM 'filepath\filename.csv'
    WITH ( MAXERRORS = 1,  FIELDTERMINATOR = ',')
END TRY 
BEGIN CATCH
    EXECUTE  dbo.ERROR_LOG_CSV;
END CATCH

I would like to be able to capture the following error when it occurs:

Bulk load data conversion error (truncation)

But it seems that I can't, even though the level is 16 which falls within the try-catch range. I was wondering if there is a way to capture this error when it occurs.

Before I specified the MAXERRORS to 1 I got this error:

Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

Since the former error is much more descriptive to the problem, that is the one I'd like to record.

解决方案

Though my competence is more Oracle than SQL Server, anyway I'll try to help somehow with this issue. I discovered that your situation is already in the bugtracker of SQL Server (bug id: 592960) with status "Won't fix" since 2010. You can see the corresponding discussion on connect.microsoft.com yourself (on the present moment host is unreachable so I used google cache).

这篇关于SQL Capture BULK INSERT错误4863的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆