Stored procedure gives different result when called directly or from vb script

  • hi,

    here is a thing that bothers me:

    I created a stored procedure that takes 2 strings as input. One is a keyword to search for in different field in different tables. The other an email address.

    When I call the procedure from Query Analyzer I get the expected result as attachment mailed to me.

    When I call the procedure from a vb script I get the mail with attachment but it is emtpy....

    I traced it with profiler and the call is made exactly the same.

    Anyone know what's going on? Is this something from SQL Server, vbs (ADODB.Connection) or maybe in exchange?

    Any help is welcome 🙂

    Cheers, JW

  • Does the user that run VB has the right to execute store proc? Do you have try ... catch block? If yes, is the error = 0?

    Alex Prusakov

  • It sounds as though your proc is sending the email since you receive the message when running the proc directly from query analyzer.

    If you are receiving the email with empty data, it would lead me to believe it is not a permissions issue, as the message is still being sent, therefore the proc is still executing.

    There may be a difference in how your paramters are being passed, which is causing the empty data attachment.

    Do you have any code samples, both vbscript and proc that you can post?

  • Hi,

    I have solved it by setting a high time out on the ADO connection (300 sec)

    Thanks for the replies anyway, it always helps to view things from a different angle.

    Cheers, JW

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

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