|
Posted by Erland Sommarskog on 05/19/06 10:38
(theintrepidfox@hotmail.com) writes:
> It throws an error in Line 17 IF (LEN(@TelNo) < 1) BEGIN SET @TelNo =
> NULL END when the error is actually in line 23: SET @CommentOrg =
> (SELECT Comment from fra_company WHERE CompanyID = @CompanyID)
>
> ErrorMsg:
> Msg 137, Level 15, State 2, Procedure fra_UpdateCompany, Line 17
> Must declare the scalar variable "@ContactID".
>
> Why is that? I had hoped that it had improved from SQL 7.0 to 2005 but
> it's still the same vague thing.
SQL Server is not very good at error messages. In some cases the errors
are flagged on the next statement. And how nice isn't when you have a 50+
lines statement with a misspelled column name, and you only get the line
number where the statement starts!
I've submitted a request for improvements on
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=362114fa-e9ea-4494-a56e-3d6addb69f5d
go and vote for it if you like!
That said, I've never seen anything as bad as in your example, so I suspect
that there is something more to it. And I cound find any undeclared
@ContactID in you example...
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|