Search

Apr 4, 2007

Exception Handling in SQL2k5

Hi

For handling exception just need to write 4 additional statements!


BEGIN TRY
print convert(int, 'hi')
END TRY
BEGIN CATCH
print @@ERROR
print 'ERROR'
END CATCH

OUTPUT:
245
ERROR

It's simple!!