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--