Re: Line numbers returned by Query Analyzer on sql errors

From: David Gugick (davidg-nospam_at_imceda.com)
Date: 10/15/04


Date: Fri, 15 Oct 2004 10:40:57 -0400

Stephen Ahn wrote:
> Using SQL server version 8.00.760
> Given two scripts :
>
> Script A :
> ==
> print 'xyz'
> exec dbo.doh
> ==
>
> Assuming stored proc 'doh' does not exist, when
> I run the above as one batch in Query Analyzer,
> I get the result :
> ==
> xyz
> Server: Msg 2812, Level 16, State 62, Line 2
> Could not find stored procedure 'dbo.doh'.
> ==
>
> Now Script B :
> ==
> print 'abc'
> select * from doh
> ==
>
> Assuming table 'doh' does not exist, I get :
> ==
> abc
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'doh'.
> ==
>
>
> The line number reported for the error in script A is :
> 'Line 2', which make sense, but the
> line number reported in script B is 'Line 1',
> which seems strange.
>
> Can anyone shed any light into this ?
> Thanks,
> Stephen

Run those statements in Profiler using SQL:StmtStarting/Completed,
SQL:BatchStarting/Completed, SP:Stating/Completed,
RPC:StartingCompleted, and SP:StmtStartingCompled and see of the results
shed some light on your question.

-- 
David Gugick
Imceda Software
www.imceda.com


Relevant Pages

  • Re: Delete mails by subject using mailx ?
    ... mailbox having subject xyz" ... I want to run this using a crontab scheduled script. ... echo "oldmailbox is locked. ... # replace the oldmailbox with newmailbox. ...
    (comp.mail.misc)
  • Line numbers returned by Query Analyzer on sql errors
    ... print 'xyz' ... Assuming stored proc 'doh' does not exist, ... Now Script B: ... select * from doh ...
    (microsoft.public.sqlserver.tools)
  • Line numbers reported by tools on errors
    ... print 'xyz' ... Assuming stored proc 'doh' does not exist, ... Now Script B: ... select * from doh ...
    (microsoft.public.sqlserver.programming)
  • Re: problems with grep
    ... I want to write a script that will look at other scripts and find ... And why does this match xyz but not abc ???? ...
    (comp.unix.shell)
  • Re: problems with grep
    ... I want to write a script that will look at other scripts and find ... And why does this match xyz but not abc ???? ...
    (comp.unix.shell)