How to use SQL Server Profiler


Like to learn how to use SQL Server Profiler to troubleshoot your database operations? Learn the basics of SQL Server profiler and how to use it.

SQL Server Profiler allows you to trace the database queries that you run against your database. This is very helpful when you are trying to troubleshoot your code which is not really doing what is expected on the database.

Consider this scenario. You are developing an Applications and you expect some data to be saved in the database when some event happens Or, you may be using an application which read data from some excelfile and save into database but you don't see the data saved in to the database. Somewhere the operation fails without giving an error and now you like to know if the data is really sent to database or not.

SQL Server Profiler helps you trace the sql statements executed against the database and helps you find what sql statements are really executed against the database from your code.



How to launch SQL Server Profiler


You can launch the SQL Server profiler from your Programs Menu if you have the complete SQL Server client tools installed.

Open your Programs menu from Windows Start screen. Select SQL Server and then expend "Performance Tools". You will see SQL Server Profiler listed there. Select it to launch the profiler.

SQL Server Profiler

If you have SQL Server Management Studio open, you can launch the profiler directly from there. Click on the Tools menu and then select "SQL Server Profiler".

How to use SQL Server Profiler


Once you have launched the profiler, you can start a session. Click on "File" and then "New Trace" in the menu. This will start a new tracing session.

You will be prompted to connect to your SQL Server instance to run the profiler against. Choose the right connection settings so that you can run the profiler against the database.

Connect to database

After you connect to the database, you will be prompted to select the trace properties. You may leave all options to the default values. Make sure the template "Standard" is selected in the field for "templates".

Run SQL Profiler

Click on "Run" to start the session in the profiler.

You will see a new window opened which will show all SQL statements executed against the database to which you are connected.

SQL Profiler Running

If you are debugging some code and trying to figure out what values are sent to the database, try do it now. Run your applications or debug it step by step. After each step of the database operation, come back to the SQL Profiler and see the database statements executed by code.



Hope this article was helpful to debug your database operations.


Article by Tony John
Tony John is a professional blogger from India, who started his first Weblog in 1998 at Tripod.com. Tony switched to blogging as a passion blended business in the year 2000 and currently operates several popular web properties including IndiaStudyChannel.com, Techulator.com, dotnetspider.com and many more.

Follow Tony John or read 703 articles authored by Tony John

Comments

Guest Author: christi parks03 Dec 2012

Hello, i would like to ask that what is the benefits of sql training, what all topics should be covered and it is kinda bothering me … and has anyone studies from this course http://www.wiziq.com/course/125-comprehensive-introduction-to-sql of SQL tutorial online?? or tell me any other guidance...
would really appreciate help… and Also i would like to thank for all the information you are providing on sql training.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: