Better error message please...SQL Error '...is not a recognized table hints option'

Tags: SQL

I was getting the following error in a stored procedure that I had written. Nothing fancy in it as far as concern with using any new features of SQL 2005.

Msg 321, Level 15, State 1, Line 5

"sql_handle" is not a recognized table hints option. If it is intended as a parameter to a table-valued function,
ensure that your database compatibility mode is set to 90.

I googled about it and most of the places (like this) the answers are about checking the database compatibility. I looked at our database's configuration and everything seemed fine to me.

Then I realized that I had used the dynamic sql in the stored proc and between two lines of the sql statements, I had forgotten the "space" and that's why I was getting that error. How the hell on the earth that has to do with the error message above?

Why can't SQL management studio give better (correct) error message? Come on, am I asking for too much here?

2 Comments

  • Carlos said

    Interesting... I have got exactly the same problem... but what did cause it was an error in one of my "joins"... it was missing the 'on'. So below the pseudo-sql I used... if you take out capital ON on the first left join... you get the error. select c1, c2, c3, a.f1, count(g.f1), count(h.f1), count(b.f2), count(c.f2), count(d.f2) from dbo.vwView left join tb001 a ON ( vwView.c1 = a.c1 and vwView.c2 = a.c2 and vwView.c3 = a.c3 and a.c4 = 'BLA BLA BLA' and a.c5 = 'ZZZ ZZZ' and a.c6 NOT IN ( 'XYZ', 'ZYX' ) ) left join tb001 b on ( a.ID = b.ID and b.f2 = 'EL' ) left join tb001 c on ( a.ID = c.ID and c.f2 = 'DL' ) left join tb001 d on ( a.ID = d.ID and d.f2 = 'GR' ) left join tb001 g on ( a.ID = g.ID and g.f1 = 'CA' ) left join tb001 h on ( a.ID = h.ID and h.f1 = 'FU' ) where c1 '00' group by c1, c2, c3, a.f1

Comments have been disabled for this content.