Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Using SQL Server Management Studio, how can check or see who is running a certain SQL statement?

share|improve this question

migrated from stackoverflow.com May 7 '13 at 12:13

This question came from our site for professional and enthusiast programmers.

4 Answers 4

up vote 1 down vote accepted

In SQL Server Management Studio you can use Activity Monitor. Right click on the root server item in Object Explorer or from the top panel. The Processes section contains info about the callers.

share|improve this answer
    
perfect thanks a lot man ,much appreciated –  C_Major May 7 '13 at 11:31
    
You are welcome! –  Olexander May 7 '13 at 11:32

Depending on what your requirement is (i.e. you want to see a trace of all the times certain T-SQL was run) you may want to look at SQL Trace (Profiler will create a client-side trace and have a significant performance impact. Create a server-side trace by scripting out the trace in Profiler and running it directly on the server instead of keeping the Profiler trace running. If you need more info on this I can elaborate). Or if you're on SQL Server 2008 or higher then you should be using Extended Events.

The SQL Trace event class is SQL:StmtCompleted.

The Extended Events event is sql_statement_completed.

share|improve this answer

Use the stored procedure 'sp_who' or 'sp_who active'. This will show active processes

share|improve this answer

Use the built-in Profiler, you can find it under Tools->SQL Server Profiler.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.