You are here: Re: Finding prepared statement sql « MsSQL Server « IT news, forums, messages
Re: Finding prepared statement sql

Posted by Erland Sommarskog on 06/02/06 21:48

birju (floating.buddha@gmail.com) writes:
> I'm running SQL Profiler on an SQL Server 2000 database. I see that one
> stored procedure gets repeatedly executed having a handle of '1'. This
> query takes a long time to complete.
> How do I find what the text of the stored procedure is? I cant see any
> handle being created (using sp_prepare) with an id of '1' in the
> profiler. Is there any way to force the server to re-prepare all
> statements so that I can see the statement text and its preparation in
> SQL Profiler?

As far as I know, it should be enough to kill that connection. But it sounds
strange that there is no sp_prepare. It could be the case that the
sp_prepare is filtered out for some reason?

You should also include the Performance:Showplan event in the trace. The
you would at least see which tables the prepared query accesses.

By the way, if you don't see the query text, how do you know that it's
the execution of a stored procedure? Stored procedure calls should be
called through RPC, and RPC calls are not prepared...

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация