How to check if a column is empty or null using SQL query select statement?
Here's a slightly different way:
SELECT *
FROM UserProfile
WHERE PropertydefinitionID in (40, 53)
AND (LEN(ISNULL(PropertyValue,'')) = 0)
Does this do what you want?
SELECT *
FROM UserProfile
WHERE PropertydefinitionID in (40, 53)
AND ( PropertyValue is NULL
or PropertyValue = '' );
Here is my preferred way to check for "if null or empty":
SELECT *
FROM UserProfile
WHERE PropertydefinitionID in (40, 53)
AND NULLIF(PropertyValue, '') is null
Since it modifies the search argument (SARG) it might have performance issues because it might not use an existing index on the PropertyValue column.