我有一个巨大的批量插入导致错误:
DECLARE @row_terminator CHAR;
SET @row_terminator = CHAR(10); -- or char(10)
DECLARE @stmt NVARCHAR(2000);
SET @stmt = '
BULK INSERT accn_billed_procedures
FROM ''F:\2011-Dec\accn_billed_procedures_201112062112.txt.gz''
WITH
(
firstrow=2,
FIELDTERMINATOR = ''|'' ,
ROWS_PER_BATCH=10000
,ROWTERMINATOR='''+@row_terminator+'''
)'
exec sp_executesql @stmt;
SET @stmt = '
BULK INSERT accn_billed_procedures
FROM ''F:\2011-Dec\accn_billed_procedures_201112072112.txt.gz''
WITH
(
firstrow=2,
FIELDTERMINATOR = ''|'' ,
ROWS_PER_BATCH=10000
,ROWTERMINATOR='''+@row_terminator+'''
)'
exec sp_executesql @stmt;
SET @stmt = '
BULK INSERT accn_billed_procedures
FROM ''F:\2011-Dec\accn_billed_procedures_201112082112.txt.gz''
WITH
(
firstrow=2,
FIELDTERMINATOR = ''|'' ,
ROWS_PER_BATCH=10000
,ROWTERMINATOR='''+@row_terminator+'''
)'
exec sp_executesql @stmt;
SET @stmt = '
BULK INSERT accn_billed_procedures
FROM ''F:\2011-Dec\accn_billed_procedures_201112092112.txt.gz''
WITH
(
firstrow=2,
FIELDTERMINATOR = ''|'' ,
ROWS_PER_BATCH=10000
,ROWTERMINATOR='''+@row_terminator+'''
)'
exec sp_executesql @stmt;
SET @stmt = '
BULK INSERT accn_billed_procedures
FROM ''F:\2011-Dec\accn_billed_procedures_201112102112.txt.gz''
WITH
(
firstrow=2,
FIELDTERMINATOR = ''|'' ,
ROWS_PER_BATCH=10000
,ROWTERMINATOR='''+@row_terminator+'''
)'
exec sp_executesql @stmt;
我想知道导致的所有错误(或至少很多错误)。
如果它需要我运行所有内容以获取错误列表,对我来说并不重要。
我只想知道是否可以显示 sql 语句将在 sql server 2008 中生成的所有错误?