T-SQL Tutorial

T-SQL Error_line()


Return the line number of the error that use the CATCH block of a TRY ... CATCH.

Error_line() Syntax

ERROR_LINE();

Error_line() Example

USE model;
GO
BEGIN TRY
   SELECT 8/0;
END TRY
BEGIN CATCH
   SELECT ERROR_LINE() AS Error_Line;
END CATCH;
GO

Error_Line
2

See also:
T-SQL Functions -> ERROR_MESSAGE()