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

Define indexes?

0 Answers  


What are the advantages of using stored procedures? Please don't simply say compilation time will be saved as they are already complied. Please specify some other advantages.

3 Answers   247Customer,


What is the difference between ddl,dml and dcl commands?

0 Answers   BirlaSoft, Verifone,


Can group functions be used in the order by clause in ms sql server?

0 Answers  


How to retrieve range of 10th rows to 20 th rows from total rows from a database table.? (Not from Dataset)

10 Answers   Cognizant, Infosys,






How to create a dml trigger using create trigger statements?

0 Answers  


After using delete statement in sql query to delete some records...to retrieve the deleted records we can get using rollback command but till that where it stores means particular location name i need....(after deleting and rollback )

3 Answers   CarrizalSoft Technologies, iGate,


Explain stored procedure?

0 Answers  


What are different types of constraints?

0 Answers  


What is user-defined scalar function?

0 Answers  


What is a periodical index?

0 Answers  


How to create logins using windows Authentication mode?

2 Answers  


Categories