I am building an html table to be injected into an email. I need this to be able to be ran directly out of sql. what I have so far is....
SELECT col1 AS 'td','',
col2 AS 'td','',
col3 AS 'td','',
col4 AS 'td'
FROM TABLE
FOR XML PATH('tr'),ELEMENTS AS NVARCHAR(MAX)
I Would like to add a class to the row so that i can control the font of the whole row depending upon the value of say col3.
I come from the programming world so i am not familiar with the sql equivalent of the following... Pseudo Code Something like :
SELECT col1 AS 'td','',
col2 AS 'td','',
col3 AS 'td','',
col4 AS 'td'
FROM TABLE
if col3 == 'fail' then FOR XML PATH('tr class=red'),ELEMENTS AS NVARCHAR(MAX)
else if col3 == 'warn' then XML PATH('tr class=yellow'),ELEMENTS AS NVARCHAR(MAX)
else FOR XML PATH('tr'),ELEMENTS AS NVARCHAR(MAX)