Solved

SQL sys.sysprocesses

Posted on 2012-03-28
3
443 Views
Last Modified: 2013-02-15
Hello
We have a process to monitoring the access to database.
Why exist processes without query command (sys.dm_exec_sql_text) that sql_handle value of the sys.sysprocesses is 0x000000000000000000000000000000000000000000000000 ?
What types of access are?
0
Comment
Question by:Jaimesastre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 37778936
That is the query handle like:


sql_handle
 

binary(20)
 

Represents the currently executing batch or object.

Note   This value is derived from the batch or memory address of the object. This value is not calculated by using the SQL Server hash-based algorithm.
 
http://msdn.microsoft.com/en-us/library/ms179881.aspx

You need a cross apply to find the actual statement if that's what you need.
0
 

Author Comment

by:Jaimesastre
ID: 37780676
Thanks.

We need know in real time all runing  process in the sql server with the query sys.sysprocesses.

We can know what is the query or process description of the row with SQL_Handle value 0x000000000000000000000000000000000000000000000000.

Is possible know it?

Regards
0
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 37806340
You need to run a query like below to get all details and you could include a where clause as well:



SELECT
      BatchText            = SQLText.text ,
      BatchPlan            = QueryPlan.query_plan ,
      ExecutionCount      = CachedPlans.usecounts ,
      ObjectType            = CachedPlans.objtype ,
      Size_KB                  = CachedPlans.size_in_bytes / 1024
FROM
      sys.dm_exec_cached_plans AS CachedPlans
CROSS APPLY
      sys.dm_exec_query_plan (CachedPlans.plan_handle) AS QueryPlan
CROSS APPLY
      sys.dm_exec_sql_text (CachedPlans.plan_handle) AS SQLText
--WHERE ....
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question