Everything is doing what it should. I end up with a 2 column HTML table using the following code, but I'd like to set the background color, conditionally, and at the cell level.
SET @tableHTML =
N'Your data ........................email.' +
N'<b>Property: </b>' + @prop +
N'<b>Submitted: </b>' + @insert_dt +
N'<b>Submit Type: </b>' + @zsubtype +
N'<table border="1 "cellpadding="10">' +
N'<tr><th align="center">Month</th><th align="center">Issue</th></tr>' +
CAST ( (
SELECT
td = ph.occ_month,
'', -- xml col separator
td = COALESCE(ds.descr,'--')
FROM
#phold ph
LEFT OUTER JOIN
datasub_CHK ds
ON ph.months_out = ds.val1-1
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>'
I'm trying to get "<td bgcolor="red">" into the @tableHTML statement ONLY WHEN the second column of the SQL statement is a certain value (<> "--")
Has anyone done this? I can't screw with the SQL portion of the code without fouling the whole show.
Thank you!