Query SQL Server by Email

  • Hi Guys,

    I vaguely remember from SQL 6.5 days (and this could be a total recall memory) that there was a way to query SQL by email.

    Ie. You email the select query or stored proc and sql replies to that email address with the results attached.

    Did this exist? Or am I making that up - and if it did exist, does it still exist in 2008R2?

    Cheers

    Alex

  • Alex

    Yes, that did exist, possibly up to SQL Server 2000. As far as I know, you can't do it any more. Too much of a security risk, I imagine.

    John

  • Dear Alex,

    As far as i know with my limited experience with SQL Server i have not seen a scenario where in we can send the query/SP in the email and sql server will send us the results. That being said it is possible to send the output of a query/SP on an email address using SQL server Agent.

    You can design a SP which will get the output of the query and send it to desired recipients using in-built proc sp_send_dbmail. Pre-reqs for using sp_send_dbmail is that you should have database mail enabled and a profile created in it for sending emails. You can schedule this proc to run and send the email after a regular interval of time by using Sql server Agent.

    Additional Resource:

    # http://www.brentozar.com/archive/2014/10/send-query-results-sql-server-agent-job/

    Hope it helps..!!

    Regards

    Shafat Husain

    Regards,
    Shafat Husain
    🙂
    And Your Lord Never Forgets...!! (64:19 -- Quran)

  • Aw, cheers! Its removal both sensible and a shame!

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

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