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)
 Query problem: Due to spaces in file path

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-01-09 : 11:00:32
I am using teh following command to send an email from Stored proc: the @filepath is the one which is having problem since some times the file path has spaces in it, how can i handle the spaces in file path:

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'projectMail',
@recipients=@recipient,
@body = @mailbody,
@subject=@Subject,
@file_attachments=@filepath

Example @filepath:
'D:\ProjectDocs\JBB\PM\54.384-Configuration Prerequisites.doc'



Thank you very much for the information.

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-01-09 : 11:20:37
Try inserting extra set of double-quotes:
set @filepath = '"' + @filepath + '"'

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'projectMail',
@recipients=@recipient,
@body = @mailbody,
@subject=@Subject,
@file_attachments=@filepath
Go to Top of Page
   

- Advertisement -