あなたの質問に答えるためにしようとする前に、私はいずれかを掲示するように、あなたの質問をより明確にするためにあなたを依頼したいですこのために書かれたスクリプトや、直面しているエラーなど、あなたのために簡単に質問を書くことができます。
以下は、要件を満たすのに役立つSQLスクリプトです。スクリプトは動作確認済みです。
declare @EmailBody NVARCHAR(MAX);
declare @username VARCHAR(50) = 'Sean';
SET @EmailBody = N'<p style="font-family:arial; font-size:13px;">'+
'Hello:<br/><br/>'+
'Following program has been submitted by '+ @username +' at '+convert(varchar(50),getdate(),103)+ ' for your review.'+
'Please review the program and take further action.<br/></p>'+
'<table border="1" cellspacing="0" cellpadding="4" style="font-family: Arial; font-size: 11px;">' +
'<tr>
<td>Program No:</td>
<td>xxxxxxxxxxx</td>
</tr>
<tr>
<td>Description:</td>
<td>xxxxxxxxxxx</td>
</tr>
<tr>
<td>BUnit:</td>
<td>xxxxxxxxxxx</td>
</tr>
<tr>
<td>Program Type:</td>
<td>xxxxxxxxxxx</td>
</tr>
<tr>
<td>Product Line:</td>
<td>xxxxxxxxxxx</td>
</tr>';
--select @EmailBody
EXEC msdb.dbo.SP_SEND_DBMAIL
@recipients='add recepients here seperated by ; eg : [email protected];[email protected]',
@subject = 'Write email subject here',
@body = @EmailBody,
@body_format = 'HTML';