Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Using HTML sp_db_sendmail... can you conditionally set the CELL bgcolor when creating @tableHTML? Expand / Collapse
Author
Message
Posted Monday, May 24, 2010 2:20 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 10:25 AM
Points: 860, Visits: 730



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!


Post #927067
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse