views:

116

answers:

2

If there's one thing that I hate about SQL Server, it's the horribly unhelpful error messages. My favorite is "Incorrect syntax near..." because it provides almost no hint as to what's wrong.

Are there any tools to get a better idea of what's wrong with the statement? Or does anybody have any other helpful hints for figuring these kinds of errors out?

+1  A: 

Hm... It is possible to double-click the error message in SQL Management Studio and it will jump to the position where the error occurred.

This is at least sometimes helpful, though it doesn't work 100% of the time. Some errors are definitely too obscure, but since this is everything the database engine tells the outside world, I somehow doubt that there are tools that can provide better help.

Tomalak
+1  A: 

It won't help you on SQL 2005, but SQL 2008 has both intellisense and syntax checking built into management studio. Most syntax errors there get the red squggly line that we're familiar with from Visual Studio.

Downside is it only works when connected to a SQL 2008 server.

GilaMonster
Sigh... We really need to upgrade to 2008. :-(
Jason Baker
Don't do it for the intellisense alone. It's got a long way to go before it gets to what VS has. It's a step in the right direction, but just a step.A fair no of SQL professionals I know turn it off and go with a 3rd party intellisense tool. Downside to that is most 3rd party tools just do the intellisense, not the syntax checking.
GilaMonster