What happens when you try and trim an empty string or a bunch of spaces in SQL Server? Does it become null
or ''
?
Here's an easy way to test string manipulations, manually throw some strings together and find out:
;with cte as (SELECT ' 0 ' AS col
UNION SELECT ' ' AS col
)
SELECT LTRIM(RTRIM(col)) as col
FROM cte
Which returns a zero and a blank string. To get a NULL
you'd have to use NULLIF()