October 22, 2008 at 9:20 am
Hi...
I've got a really strange one here.... I'm trying to send an email with an attachment, it works, but for reason there are lines of spaces between each record. If I just run the SP to a file it's fine, as soon as I send it as an attachment it adds 21 lines of 256 spaces between each record.
ANY IDEAS....PLEASE
Here's the code I call from SQL Agent to send the email.
declare @body1 varchar(4000)
set @body1 = 'ERP upload generated by SQL. ' + CONVERT( VARCHAR( 20 ), GETDATE(), 113 ) +
' '
SELECT @body1 = @body1 + DWGFileName + ' '
FROM ERP.dbo.tblDWG d
WHERE ( d.Rev = '0' OR d.Rev >= 'M' )
EXEC msdb.dbo.sp_send_dbmail @recipients='SQL@SQL.COM',
@subject = 'ERP Upload',
@body = @body1,
@body_format = 'HTML',
@query = 'EXEC ERP.dbo.usp_GenerateERPFile',
@query_result_header = 0,
@exclude_query_output = 1,
@append_query_error = 1,
@attach_query_result_as_file = 1,
@query_attachment_filename = 'ERP.psv'
October 22, 2008 at 10:02 am
This is a duplicate posting. Please do not cross-post. Replies should be directed to http://www.sqlservercentral.com/Forums/Topic589877-149-1.aspx
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply