Results 1 to 5 of 5

Thread: email SQL data

  1. #1
    Join Date
    Oct 2003
    Location
    South Carolina
    Posts
    2

    Unanswered: email SQL data

    How can I extract data from a table to excel then email it as an attachment.

  2. #2
    Join Date
    May 2003
    Location
    Rochester, NY
    Posts
    135

    Re: email SQL data

    I would bcp the data out in a delimited format and if it must be, import into a spreadsheet to send as an attachment...

    ...you could just bcp it out comma delimited and let the recipient import it into the spreadsheet to if possible...

  3. #3
    Join Date
    Oct 2003
    Location
    South Carolina
    Posts
    2
    this needs to be automated. It is going to send out an email notifiying a user of a new entry in the database. the new data will be included in the email.

  4. #4
    Join Date
    Oct 2003
    Posts
    24
    Originally posted by tonyh
    this needs to be automated. It is going to send out an email notifiying a user of a new entry in the database. the new data will be included in the email.

    Use DTS to export to the excel file, and then have it email the user with the excel file attached, or put the excel doc in a shared location, make it a linked server, and update it with a sql statement.

  5. #5
    Join Date
    Oct 2003
    Location
    Pune, India
    Posts
    14
    I suggest you can create an instance of MS EXCEL in a stored procedure using sp_OACreate.

    Then transfer the data from the table to the excel object (Within the stored procedure itself)

    Then inside the stored proc use xp_sendmail to send the excel file. But unfortunately xp_sendmail uses MAPI provider through either MS Exchange or MS Outlook.

    Alternatively you can again use sp_OACreate to instantiate a third-party COM component (for example RKMAIL or JMAIL) and use the same for sending the excel file as an attachment to the mail.
    Thanks & Regards,
    Dipayan Sarkar
    (dipayan@covisible.com)
    (CoVisible Solutions - A Knowledge Management Software company)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •