Database maintenance plan

  • Through Database maintenance plan i had configured database backup and backup report text file , so backup was taken daily scuccessfully,and i want send email from server through SMTP.so i had execute the sql script for email alert, it was working fine,

    i had execute the The following script

    declare @rc int

    exec @rc = master.dbo.xp_smtp_sendmail

    @FROM= N'WJMN0130136',

    @FROM_NAME= N'JG-IDC-SQL Server',

    @TO= N'ananda.murugesan@zmail.ril.com',

    @replyto = N'',

    @cc= N'',

    @BCC= N'',

    @priority= N'NORMAL',

    @subject= N' SQL Server Mail',

    @message= N'Goodbye have a nice day, this is for test mail from MSSQL',

    @messagefile= N'',

    @type= N'text/plain',

    @attachment= N'',

    @attachments= N'',

    @codepage= 0,

    @server = N'servername'

    select RC = @rc

    go

    i want script itself how to attach at @messagefile backup report text file automatically from particular disk path,

    For example - @messagefile = N' C:\dbbackup\filename.txt', this file name has been changed daily whenever take backup. so i need send email the backup teport text file,

    I want set the file name dynamic in @messagefile = N' C:\dbbackup\filename.txt'

    Thanks

  • Please don't post multiple threads with the same topic. It just wastes people's timeas they answer posts already answered. It also fragments replies and makes things harder to find

    No replies to this thread please. Direct replies to:

    http://www.sqlservercentral.com/Forums/Topic584368-5-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • For this I would recommend you to use SSIS package. You can easily create a SSIS package for this purpose.

    Search in SQL server Central, you may get a package ready (depends on ur luck).

    Its really easy to create these kind of packages in SSIS.

    Its bit difficult to achieve this goal using only SQL SERVER

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply