General information
Forum:
Microsoft SQL Server
Title:
Send email and attach different files
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
Thanks
Jim
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only