日期:2014-05-17 浏览次数:20545 次
declare @prob nvarchar(max),@name nvarchar(max),@phone nvarchar(max),@add nvarchar(max),@contract nvarchar(max)
set
set @prob=
'<table border=1>'+ CAST((select top 1
'<tr><td>名称:</td><td>'+@name+'</td><td>电话</td><td>'+@phone+'</td></tr>'
'<tr><td>地址:</td><td>'+@add+'</td><td>联系人</td><td>'+@contract+'</td></tr>'
from tc_account
FOR XML PATH('tr'), TYPE ) as nvarchar(max))
+ N'</table>'
--set @mail=@mail
EXEC msdb.dbo.sp_send_dbmail
@profile_name = '邮件配置文件名',
@recipients = '邮件地址',
@body = @prob,
@subject = @name
<style>
.tt th{background:#a9a9a9;background-color:red;color:white;}
.tt tr{font-weight:100;font-size:12;width:120pt;text-align:center;font-family:Lucida Sans Unicode;}
.tt tr.altrow{
background-color:#c7e5ff;
}
.tt td{width:100px;padding:5px;word-wrap: break-word; word-break : break-all;}
</style>'
<table class = "tt" border="1" style="border-collapse:collapse;table-layout:fixed;word-break:break-all;">