I'm coding a SQL Server query that queries hard drive information from a series of computers and highlights the drives with less than 20% capacity. I'd like to make the ones with 10% or less capacity yellow. I'm using a case statement in my query and I'm having trouble with the syntax.
CASE
WHEN ((UsedSpace/CAST(TotalSpace as decimal(18,2))) > 0.9)
THEN CAST('''<font color="yellow">'' + [FreeSpace] + ''</font>''' AS varchar(150))
ELSE [FreeSpace]
END AS 'td',
This causes an error:
Conversion failed when converting the varchar value ''' + [FreeSpace] + ''' to data type int.