SQL sys.sysprocesses

Posted on 2012-03-28
Last Modified: 2013-02-15
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?
Question by:Jaimesastre
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
LVL 40

Expert Comment

ID: 37778936
That is the query handle like:



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.

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

Author Comment

ID: 37780676

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?

LVL 40

Accepted Solution

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:

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

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How come this XML node is not read? 3 52
T-SQL: Need a database plan to mine a pretty big Log table 4 50
When are cursors useful? 8 58
SQL Query 20 14
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 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