Click here to Skip to main content
Click here to Skip to main content

Tagged as

How to trace SQL Server Express without using SQL Profiler

, 20 Feb 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
SQL Profiler is not included with SQL Express, this tip will help if you need to track client activity.
To trace T_SQL queries submitted to SQL Express:

Start the SQL Express Service from the command prompt (run command prompt as Administrator if you are working on Windows 7 or Vista) with the following Trace Flag:

net start MSSQL$SQLEXPRESS /T4032

This now causes all queries issued by all conections to be traced. In order to have the trace output sent to the error log, enable trace flag 3605.

Execute the following in SQL Server Management Studio:

dbcc traceon(3605, -1) -- The -1 makes this global, i.e. applies to all sessions / connections

The logs can be found in C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log\ERRORLOG.

The logs will now contain the queries that were issued by the clients.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

BillyGoatGruff
Software Developer (Senior)
United Kingdom United Kingdom
No Biography provided

Comments and Discussions

 
QuestionThe log file location varies in different machine. Pinmemberleiyangge11-Mar-14 21:19 
QuestionSQL Server Profiler 2012 Free PinmemberIvan Dario Ospina13-Jun-13 8:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141220.1 | Last Updated 20 Feb 2012
Article Copyright 2012 by BillyGoatGruff
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid