日期:2014-05-17  浏览次数:20556 次

用SQL SERVER 发送HTML邮件 怎么设置table中的边框
set @strHtml=N'<h3>'+@mday+N'参考表</h3>'+'<table  style=border-collapse:collapse;  width:100%;font-size:18px;>'+
N'<tr style=border-bottom:#000 solid 2px;><th style=background:#cee4fc;border:#ccc solid 1px; >部门</th><th style=background:#cee4fc;border:#ccc solid 1px; >人数</th><th style=background:#cee4fc;border-right:#000 solid 2px;>平均</th><th style=background:#cee4fc>20hr↓</th><th style=background:#cee4fc>20~36hr</th><th style=background:#cee4fc>36~45hr</th><th style=background:#cee4fc>45~55hr</th><th style=background:#cee4fc>55~65hr</th><th style=background:#cee4fc>65~80hr</th><th style=background:#cee4fc>80~100hr</th><th style=background:#cee4fc>100hr↑</th></tr>'+
CAST( (select
       case when len(buildid)>4 then 'font-size:14px;border:#ccc solid 1px;text-align:right;' else 'font-size:14px;border:#ccc solid 1px;color:blue;font-weight:bold;' end as "td/@style",
       td=deptnm,'',
       case when len(buildid)>4 then 'font-size:14px;border:#ccc solid 1px;' else 'font-size:14px;border:#ccc solid 1px;color:blue;font-weight:bold;' end as "td/@style",
       td=numshow,'',
       case when len(buildid)>4 then 'font-size:14px;border-right:#000 solid 2px;border-bottom:#ccc solid 1px;' else 'font-size:14px;border-right:#000 solid 2px;color:blue;font-weight:bold;border-bottom:#ccc solid 1px;' end as "td/@style",
       td=avgshow,'',
       
       case when len(buildid)>4 then 'font-size:14px;border:#ccc solid 1px;' else 'font-size:14px;border:#ccc solid 1px;color:blue;font-weight:bold;' end as "td/@style",
     case when ot20>0 then ot20  else  null  end ,
     
       case when len(buildid)>4 then 'font-size:14px;border:#ccc solid 1px;' else 'font-size:14px;border:#ccc solid 1px;color:blue;font-weight:bold;' end as "td/@style",
    
       case when ot36>0 then ot36  else  null  end ,
      
      case when len(buildid)>4 then 'font-size:14px;border:#ccc solid 1px;' else 'font-size:14px;border:#ccc solid 1px;color:blue;font-weight:bold;' end as "td/@style",
    
        case when ot45>0 then ot45  else  null  end ,
          case when len(buildid)>4 then 'font-size:14px;border:#ccc solid 1px;text-align:' else 'font-size:14px;border:#ccc solid 1px;color:blue;font-weight:bold;' end as "td/@style",