SQL Query - Can I compare using LEN in SELECT clause?

Posted by Matthew Jones on Stack Overflow See other posts from Stack Overflow or by Matthew Jones
Published on 2010-04-30T16:44:59Z Indexed on 2010/04/30 16:47 UTC
Read the original article Hit count: 457

Filed under:
|
|

I basically want to do this:

SELECT HasComments = CASE (LEN(Comments) > 1) WHEN 1 THEN 1 ELSE 0 FROM TableName

In other words, return a boolean telling me whether the length of Comments is greater than 1. This gives me a syntax error.

How can I accomplish this?

© Stack Overflow or respective owner

Related posts about t-sql

Related posts about select