You are here: error handling and bulk insert « MsSQL Server « IT news, forums, messages
error handling and bulk insert

Posted by Metal Dave on 10/01/50 11:33

I do not understand the error handling of SQL Server here. Any error in
bulk insert seems to halt the current T-SQL statement entirely, rendering
it impossible to log an error. The first statement below executes as
expected, and were I to replace "print" with something meaningful I could
do some useful error handling. The second statement just seems to totally
bail out after the error, preventing me from doing any useful error
handling. This is a problem b/c I would like to schedule bulk inserts and
need to be notified if there is a problem.

The following can be run in QA to demonstrate:

print 'BEFORE TYPICAL ERROR'
raiserror('Some Error', 16, 10)
if (@@ERROR <> 0) print 'I can catch and log this error - good!' else
print 'I can not catch and log this error - bad!'
print 'AFTER TYPICAL ERROR'
go

print 'BEFORE BULK INSERT'
Bulk insert Northwind.dbo.orders
from 'ThisFileDoesNotExist'
if (@@ERROR <> 0) print 'I can catch and log this error - good!' else
print 'I can not catch and log this error - bad!'
print 'AFTER BULK INSERT'
go


TIA,
Dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация