SQL Server 2000 - Filter by String Length

Posted by user208662 on Stack Overflow See other posts from Stack Overflow or by user208662
Published on 2010-04-09T18:18:42Z Indexed on 2010/04/09 18:23 UTC
Read the original article Hit count: 217

Filed under:

Hello,

I have a database on a SQL Server 2000 server. This database has a table called "Person" that has a field call "FullName" that is a VARCHAR(100).

I am trying to write a query that will allow me to get all records that have a name. Records that do not have a name have a FullName value of either null or an empty string. How do I get all of the Person records have a FullName? In other words, I want to ignore the records that do not have a FullName. Currently I am trying the following:

SELECT
  *
FROM
  Person p
WHERE
 p.FullName IS NOT NULL AND
 LEN(p.FullName) > 0

Thank you

© Stack Overflow or respective owner

Related posts about sql