Wednesday, March 22, 2006

What is SQL Profiler?

Do you use SQL Server? Are you losing track of what's going on when you run your code on SQL Server? Then you must know of this tool called SQL Profiler.

SQL Profiler uses an integrated SQL parser to build statistics on the most accessed tables and columns and can generate SQL index creation files. Other information is also gathered and displayed, such as the request time for a single request, for a class of request, and for all the requests. Sorting may be done on these views to detect database problems efficiently.

This tool can be very useful when you have a big volume of queries that you need to analyze not one by one (meaning that the specific time isn't that much of interest), but rather when you want to know what "group" of queries is taking a lot of time, such as queries on the same tables and columns but with different query values.

You can use this as an audit tool as well particular when you want to watch the traffic on your sql server.

How do I get SQL Profiler?

SQL Profiler is one of the standard suite of client tools that are distributed with SQL Server 2000. You can install these tools from the SQL Server setup disk; they are a part of the main SQL Server setup, but you don't have to install SQL Server to install the client tools.

After installing the client tools, you can launch SQL Profiler by selecting Start, Programs, Microsoft SQL Server, Profiler. SQL Profiler will open without apparently doing anything. It's waiting for you to define a trace: a set of characteristics that tell it what to keep an eye on. That is what it does, keeps an eye on what's going on in the database.

No comments:

INSERT EXEC failed because the stored procedure altered the schema of the target table.

This morning I was trying to call a stored procedure and insert the results in a temp table using the following code  -- create table #...