Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Send email and attach different files
Message
 
 
To
12/10/2004 15:00:44
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00950802
Message ID:
00950816
Views:
14
Use single quotes. For explanation see Re: Parameter reference (calling Sergey) Message #931076.
set @cmd = 'master..xp_sendmail @recipients = ''JimHou'','
   +'@subject = ''Response Report'','
   +'@attachments = ''N:\DATA\'''+@Response
>I want to send a email and attach different files each day.
>For example, today will attach file named Reponse20041012.txt. Tomorrow will another file Reponse20041013.txt.
>
>I have following code. It didn't work. I feel some confused where to use ' and ".
>
>
>
>DECLARE @cmd varchar(200)
>Declare @Response varchar(50)
>set @Response= 'Response'+CONVERT(char(8), getdate(), 112)+'.txt'
>
>set @cmd = 'master..xp_sendmail @recipients = "JimHou",'
> +'@subject = "Response Report",'
> +'@attachments = "N:\DATA\"'+@Response
>EXEC @cmd
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform