How can I know what query is executing by by a particural
user? (using sp id or any othe way.)

Answers were Sorted based on User's Feedback



How can I know what query is executing by by a particural user? (using sp id or any othe way.)..

Answer / suvendu

SELECT *
FROM Master.dbo.sysprocesses
WHERE DBID NOT IN (1,2,3,4) -- Master, Tempdb, Model, MSDB
AND spid > 50
ORDER BY spid DESC

Is This Answer Correct ?    2 Yes 0 No

How can I know what query is executing by by a particural user? (using sp id or any othe way.)..

Answer / prem

DBCC INputbuffer(spid)- Displays the last statement sent
from a client to an instance of Microsoft SQL Server 2005.

First 256 characters only will be displayed.


SQL statements can also be captured by running a profiler.

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More SQL Server Interview Questions

Suppose you want to implement the following relationships while designing tables. How would you do it?a.) One-to-oneb.) One-to-manyc.) Many-to-many

0 Answers  


What do we need queues in sql service broker?

0 Answers  


Tell me what are the advantages of using stored procedures?

0 Answers  


Explain syntax for viewing trigger?

0 Answers  


What is database architecture? : SQL Server Architecture

0 Answers  






What is difference between line feed ( ) and carriage return ( )?

0 Answers  


How to get the number of affected rows?

0 Answers  


How to drop existing indexes in ms sql server?

0 Answers  


What is xdr?

0 Answers  


Write a Select Query to display title for each group of records, which are collected with Compute Clause? Like titlefield column-A column-B ..... ..... ..... Sum ... titlefield column-A column-B ..... ..... ..... Sum ...

0 Answers   Crown Solutions,


SQL stops working in every 15 days displaying message that database log file is full. Log file size is 3.95 GB. It is happening after shrinking the database also. What is solution to overcome this problem. Please help me as it's urgent.

5 Answers  


Difference between Triggers and Stored Procedure

23 Answers   Claimat, HCL, Protech, Silgate,


Categories