Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL DB Mail Format....

Author  Topic 

sqldba20
Posting Yak Master

183 Posts

Posted - 2009-09-23 : 10:18:50
Folks:

Need help with alignment/format of the email. I have the sql query (below) which sends email to users when a new record is added. It works great but the alignment/format of the email is differenct. In the body I want the email in this format instead of one single line and it should be on the Left side.

New Record Updated / Inserted:
SEC : ABCDEFG
FIELD : JOHN IS GOOD



Here is the SQL used currently to send the email:

DECLARE @mailbody varchar(max)	

SET @mailbody = 'New Record Updated / Inserted: ' +
' SEC : ' + @SSEC +
' FIELD : ' + @SField


EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'XYZ',
@recipients = 'abc@pqrz.com,
@body = @mailbody,
@subject = 'Alert'




Thanks !

mandm
Posting Yak Master

120 Posts

Posted - 2009-09-23 : 13:11:30
Try this.

SET @mailbody = 'New Record Updated / Inserted: ' + CHAR(13) + CHAR(10) + ' SEC : ' + @SSEC + CHAR(13) + CHAR(10) + ' FIELD : ' + @SField
Go to Top of Page
   

- Advertisement -