Question: What is the correct way to return a string when no results are returned.
The following isn't working

```
SELECT 
TOP 1 CASE
WHEN
    CustomerName IS NULL
        THEN 
            'Unknown'
WHEN
    CustomerName = ''
        THEN
            'Unknown'
ELSE 
    CustomerName
END
AS
CustomerName FROM CUSTOMER WHERE CustomerCode = 222

```

Answer: 
It seems you want to return `Unknown` when there are no rows in your table that have `CustomerName` that's not `NULL` or not `''`.

```
SELECT COALESCE((SELECT TOP 1 CustomerName FROM 
            CUSTOMER WHERE CustomerCode = 222
            AND CustomerName IS NOT NULL
            AND CustomerName <> ''),'Unknown') CustomerName

```
If I understand the question, you want to return a value even when the WHERE clause doesn't match, and you want 'Unknown' to replace the empty string or a NULL value:

```
SELECT TOP 1 COALESCE(NULLIF(CustomerName,''),'Unknown')
FROM (
  SELECT CustomerName FROM CUSTOMER WHERE CustomerCode = 222
  UNION ALL
  SELECT NULL
) t
ORDER BY CustomerName DESC

```