A question on how to get bind variables actual values

  • How can I see bind variables of an SQL statement.

    For example,

    create PROCEDURE sample_sp_test

    (@param1 int,

    @param2 int)

    AS

    SELECT @param1, @param2

    GO

    EXEc sample_sp_test 1,4

    EXEc sample_sp_test 1,3

    EXEc sample_sp_test 1,5

    I want to be able to see

    instead of :

    SELECT @param1, @param2

    the actual values

    for example:

    SELECT 1,4

    I can not see it on SQL Server profiler

    Note that in this sample I used the parameters on the select section and not in the where clause

    but I believe that you understood my problem.

    Thanks in advance

    Ran

  • You won't see it in Profiler like that. You'd only see

    sp_test 1, 4

    for a stored procedure call in Profiler.

  • so how can I do it ?

  • you run profiler, and pick the Stored procedure events. I see it in

    SQL: Batchstarting

    SP:starting

    SQL:BatchCompleted.

  • this is not solving my problem because there are scenarios that I can not see the parameters ,

    I am searching for a general solution that I believe can not be solved using SQL profiler.

    maybe there is speciel Flag in SQL Server that save the bind variables.

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

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