Email SP Results

  • Comments posted to this topic are about the item Email SP Results

  • How to do it for all procedures available in a database and mail them to email address??


  • This is a great Utility and will definitely be in my Toolbox. With a few tweaks most people will be able to make this work for their environment.

    I had to add the Parameter @profile_name to the Stored Procedure. I also made changes the greeting and footer section.

    Thank you for sharing your code

  • Anyone having reshaped form of this code Please let me know at

  • What do you mean reshaped? Any specific requirements?

  • Great utility! I am working on implementing a similar solution. Will post an update if I can fine tune it.

  • what if lync server is not active? can this be done without it?

    I would love to use this. I receive the following errors.

    OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".

    OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "Client unable to establish connection".

    Msg 21, Level 16, State 1, Line 0

    Encryption not supported on the client.

  • Interesting concept, thanks.

  • Nicolas Thank you!
    Is there any reason why your proc cannot find a database?
    I even tried to use the Master database.

    Msg 7202, Level 11, State 2, Line 1
    Could not find server 'Master' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

    YThank you for your help!

    Jacob Milter

  • Nicolas,
    I made a few changes that allow running this proc on the Local Server without using  OPENROWSET.
    Also, you can use any Query or View  to get the record set you need/

    SET        @vcServerName        = 'Server='+(SELECT @@SERVERNAME)+';Trusted_Connection=yes;'
    Print 'Server ' + @vcServerName
    SELECT    @vcString            = 'EXEC ['+@vcDatabaseName+'].['+@vcSchemaName+'].'+(REPLACE(@vcProcName, '''',''''''))+''
    Print @vcString

    EXEC    ('
            SELECT * INTO ##MyTempTable
            FROM OPENROWSET(''SQLNCLI'', '''+@vcServerName+''','''+@vcString+''')
    print '
            SELECT * INTO ##MyTempTable
            FROM OPENROWSET(''SQLNCLI'', '''+@vcServerName+''','''+@vcString+''')

    SELECT * INTO ##MyTempTable FROM MyDatabase..[v_Current_Job_Records]

    Jacob Milter

  • Hi Jacob,

    I will give this a try - thanks for the info!

    Nicholas W.

Viewing 11 posts - 1 through 10 (of 10 total)

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