Author Topic: Custom error parsing  (Read 4417 times)

Absinthe

  • Guest
Custom error parsing
« on: August 08, 2009, 11:23:59 PM »
When setting up error parsing on files used to create my SQL Server database routinely they have multiple blocks in them separated by the word GO

Perhaps something like:

---
If exists (...
Drop Procedure ...
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
/*
 *
 * Comment
 *
 */
Create Procedure Usp_Cnt_Issues
(
   @ItemID int
)
AS
   Declare @Count int
   
   SELECT    @Count = Count(*)
...

When an error occurs, the line number is relative to the previous "GO" rather than the top of the file.  For instance if there was an error on the line that begins with SELECT it would be reported as Line 13 even though relative to the file it is at Line 20. Is there a way to make the error parsing work with this offset, even if one is to simply make the assumption that it starts at the same place (any place other than 0)?