Hi!I am pretty new to triggers, some easy ones work without problem.. but now I have a problem: I have a table with customers and if there is an update or insert in the table I get an email with C_Nr and C_Name - that works fine. But I want to send a file with the trigger. First of all I don't care about what kind of attachment... as long as I get this dam* attachment. ALTER TRIGGER [dbo].[NewCustomer]ON [dbo].[YKUN4015]FOR INSERT,UPDATEASdeclare @INTNR varchar(10) declare @Name1 varchar(50)declare @message varchar(500)declare @query_attachment_filename nvarchar(255)declare @file_attachments nvarchar(max)SET @INTNR =(SELECT INTNR FROM inserted)SET @Name1 =(SELECT Name1 FROM inserted)SET @message='New Customer with Number '+@INTNR+' and name '+@Name1+''EXEC msdb..sp_send_dbmail @recipients = 'mymail@mail.com', @subject = 'New Customer in DB', @body = @message, @file_attachments = 'J:\testdatei.txt';
I only get an error message like attachment is not valid... it is on the same Server/Harddisk like the database...Can anyone help me?