A few different ways you can do this, see in red below:DECLARE @x VARCHAR(32) = ' ';
SELECT
CASE WHEN LTRIM(@x) = '' THEN 'All spaces' ELSE 'Not all spaces' END ,
CASE WHEN LEN(@x) = 0 THEN 'All spaces' ELSE 'Not all spaces' END ,
CASE WHEN REPLACE(@x,' ','') = '' THEN 'All spaces' ELSE 'Not all spaces' END ,
CASE WHEN NULLIF(@x,'') IS NULL THEN 'All spaces' ELSE 'Not all spaces' END ;