i'm send alert email from sql server for daily attendance by convert select results to html as below , but wondering how could i apply formatting on result for example display late checkin in red and so on
DECLARE @xml NVARCHAR(MAX)
DECLARE @body NVARCHAR(MAX)
SET @xml = CAST(
(
Select
EmpID as 'td','',
EmpName as 'td','',
ActionDate as 'td','',
ActionText as 'td',''
from
AA
Where ManagerID=@managerID
FOR XML PATH('tr'), ELEMENTS
) AS NVARCHAR(MAX))
SET @body ='<html>
<head>
<!-- CSS goes in the document HEAD or added to your external stylesheet -->
<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>
<!-- Table goes in the document BODY -->
</head>
<body>
<table border = 1 class=gridtable>
<tr>
<th> Employee No </th> <th> Employee Name </th> <th> Date </th> <th> Check-In </th></tr>'
SET @body = @body + @xml +'</body></html>'