locked
How to capture actual sql query statements on 2005 express with advanced services RRS feed

  • Question

  • How to capture actual sql query statements on 2005 express with advanced services?  I use an application that creates reports from data in our sql server 2005 express database.  SQL Server has advanced services installed.  I need to know what SQL is being used when a particular report is run.  How do I capture the query when the report is run in such a way that I can actually view the SQL statements?

    Wednesday, November 27, 2013 8:15 PM

Answers

  •  Try this.... 

    http://expressprofiler.codeplex.com/  this is similar to profiler. once you installed that you need to specify the server name and start the trace and run your application.  you can sqltext in the profiler.

    or 

    dbcc traceon(4032,3605,-1)
    
    --run your application now
    dbcc traceoff(4032,3605,-1)
    
    xp_readerrorlog 0,1,'text:'
    
    Second method will return are commands execute on the server  during the time trace was enabled. I prefer first one.


    Hope it Helps!!

    • Proposed as answer by Naomi N Wednesday, November 27, 2013 11:33 PM
    • Marked as answer by Allen Li - MSFT Sunday, December 8, 2013 8:49 AM
    Wednesday, November 27, 2013 9:16 PM

All replies

  •  Try this.... 

    http://expressprofiler.codeplex.com/  this is similar to profiler. once you installed that you need to specify the server name and start the trace and run your application.  you can sqltext in the profiler.

    or 

    dbcc traceon(4032,3605,-1)
    
    --run your application now
    dbcc traceoff(4032,3605,-1)
    
    xp_readerrorlog 0,1,'text:'
    
    Second method will return are commands execute on the server  during the time trace was enabled. I prefer first one.


    Hope it Helps!!

    • Proposed as answer by Naomi N Wednesday, November 27, 2013 11:33 PM
    • Marked as answer by Allen Li - MSFT Sunday, December 8, 2013 8:49 AM
    Wednesday, November 27, 2013 9:16 PM
  • Check below link,

    http://stackoverflow.com/questions/47376/how-can-i-monitor-the-executed-sql-statements-on-a-sql-server-2005

    hope this may help

    Wednesday, November 27, 2013 10:59 PM