June 18, 2002 at 10:24 am
Hi, everybody,
I receive "Attachment open failure" while executing the following sp. Maybe somebody had this error before and knows how to avoid it or at least knows where it comes from?
Thanks
CREATE PROCEDURE [spNYBCReportsDeliver]
@ManualCallTypeID int,
@DateStart varchar(12),
@DateEnd varchar(12),
@Email varchar(255),
@Hours decimal (14, 4),
@ACD varchar(255),
@as varchar(255)
AS
Declare @Exec varchar(4000),
@ReportName varchar(255),
@FileName varchar(255)
Declare MyCursor Cursor For
Select ManualCallType From tblManualCallTypes Where ManualCallTypeID = @ManualCallTypeID
Open MyCursor
Fetch Next From MyCursor Into @ReportName
While @@Fetch_Status = 0
begin
Fetch Next From MyCursor Into @ReportName
end
Close MyCursor
Deallocate MyCursor
Select @FileName = 'NYBC ' + @ReportName + '.csv'
Select @Exec = 'spNYBCReports '
+ cast(@ManualCallTypeID as varchar(255)) + ', '
+ '''' + IsNull(@DateStart, '') + ''', '
+ '''' + IsNull(@DateEnd, '') + ''', '
+ '''' +Isnull((cast(@Hours as varchar(255))), 0) + ''', '
+ '''' + IsNull(@ACD, '') + ''', '
+ '''' + IsNull(@AS, '') + ''''
EXEC master.dbo.xp_sendmail
@Recipients='recipient',
@query=@Exec,
@attach_results='true',
@separator=',',
@no_header='false',
@attachments=@FileName,
@Subject=@ReportName,
@Width=5000,
@echo_error='true',
@dbuse='nybc'
June 18, 2002 at 4:58 pm
This sounds like file permissions preventing access to the file or the path to the file is invalid. What are you submitting in the @FileName value? It looks like you are submitting NYBC+something+.csv but I believe it has to exist on the C root or any of the paths listed with you type path at a command prompt. If you do not specify the path or it exist on the paths I mentioned, the I believe that is where the problem is coming from?
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply