Thursday, March 8, 2012

can dbcc inputbuffer show parameterized queries?

Hi,
I'm trying to capture blocking information on my SQL Server 2k box and
running dbcc inputbuffer only shows me the "sp_executesql" command, it
doesn't show me the parameters which is the actual sql. Profiler seems to
have no problem showing the parameters b/c it always shows me the sql that's
running, not the sp_executesql command. Is there some other command that
will pull the sql from a parameterized query a la Profiler? Thanks for any
help here.
lcLC,
Have you tried using fn_get_sql()? (Although for sp_executesql I usually
get nothing unless a stored procedure is being executed.)
RLF
"LC" <LC@.discussions.microsoft.com> wrote in message
news:013B24CA-D81B-48AA-9D7C-56ABA375A30D@.microsoft.com...
> Hi,
> I'm trying to capture blocking information on my SQL Server 2k box and
> running dbcc inputbuffer only shows me the "sp_executesql" command, it
> doesn't show me the parameters which is the actual sql. Profiler seems to
> have no problem showing the parameters b/c it always shows me the sql
> that's
> running, not the sp_executesql command. Is there some other command that
> will pull the sql from a parameterized query a la Profiler? Thanks for
> any
> help here.
> lc|||I've tried that function, but all of the sql handles in my databases are
0x000000... Since all of the sql handles are the same (all zero's), I'm not
getting any useful information.
"Russell Fields" wrote:
> LC,
> Have you tried using fn_get_sql()? (Although for sp_executesql I usually
> get nothing unless a stored procedure is being executed.)
> RLF
> "LC" <LC@.discussions.microsoft.com> wrote in message
> news:013B24CA-D81B-48AA-9D7C-56ABA375A30D@.microsoft.com...
> > Hi,
> > I'm trying to capture blocking information on my SQL Server 2k box and
> > running dbcc inputbuffer only shows me the "sp_executesql" command, it
> > doesn't show me the parameters which is the actual sql. Profiler seems to
> > have no problem showing the parameters b/c it always shows me the sql
> > that's
> > running, not the sp_executesql command. Is there some other command that
> > will pull the sql from a parameterized query a la Profiler? Thanks for
> > any
> > help here.
> >
> > lc
>
>|||LC
Dbcc inputbuffer shows the last command to execute through the connection.
Fn_get_sql only can work for a statement that is running _right_now_, since
as soon as a statement is complete the handle returns to 0. Therefore, most
of your sql handles should be zero, but not is a stored procedure is
actually running at the moment.
FWIW - RLF
"LC" <LC@.discussions.microsoft.com> wrote in message
news:6D105C91-1A27-413A-8117-6619CDDE76C4@.microsoft.com...
> I've tried that function, but all of the sql handles in my databases are
> 0x000000... Since all of the sql handles are the same (all zero's), I'm
> not
> getting any useful information.
> "Russell Fields" wrote:
>> LC,
>> Have you tried using fn_get_sql()? (Although for sp_executesql I usually
>> get nothing unless a stored procedure is being executed.)
>> RLF
>> "LC" <LC@.discussions.microsoft.com> wrote in message
>> news:013B24CA-D81B-48AA-9D7C-56ABA375A30D@.microsoft.com...
>> > Hi,
>> > I'm trying to capture blocking information on my SQL Server 2k box and
>> > running dbcc inputbuffer only shows me the "sp_executesql" command, it
>> > doesn't show me the parameters which is the actual sql. Profiler seems
>> > to
>> > have no problem showing the parameters b/c it always shows me the sql
>> > that's
>> > running, not the sp_executesql command. Is there some other command
>> > that
>> > will pull the sql from a parameterized query a la Profiler? Thanks for
>> > any
>> > help here.
>> >
>> > lc
>>
>>

No comments:

Post a Comment