[dba-SQLServer] Cannot sort on Abs([Field]=0)

Gustav Brock gustav at cactus.dk
Thu Aug 16 09:39:41 CDT 2012


Hi all

This works in Access SQL:

  ORDER BY Abs([SortOrder]=0)

but if the tables are linked via ODBC to SQL Server 2008, it fails:

  Incorrect syntax near '='. (#102)

I have to rewrite it like this:

  ORDER BY Abs(CBool([SortOrder]=0))

Why is that? [SortOrder] is a short integer with no Nulls.

/gustav



More information about the dba-SQLServer mailing list