﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Edward Elliott  / What is sysprocesses and what can it do for you? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 21:37:42 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>[quote][b]Wayne West (5/5/2009)[/b][hr]A friend of mine wanted to conduct a license audit of her installation and used sysprocesses to get the info...[/quote]I'm doing something similar. I'm checking sysprocesses every 5 minutes to look for users with certain patterns.I ended up here because I have been seeing one user whose sessions sometimes show up without a value in loginame! I used Profiler to watch logins and logouts and I see the session, and there is a value for the login name. When run from SSMS the query has never shown this blank loginame, but I do track it when the query is run from Server Agent.Does anyone have any idea how a session could legitimately show up in sysprocesses without a loginame? And if I don't see it in that column can I get it from somewhere else? (the case I know about is an SQL user)</description><pubDate>Thu, 13 Aug 2009 08:46:31 GMT</pubDate><dc:creator>Yitzchok Lavi</dc:creator></item><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>A friend of mine wanted to conduct a license audit of her installation and used sysprocesses to get the info.  On each server she created a DTS job that ran the following query:[code]select getdate() as StatsDate, ss.srvname as ServerName, 	rtrim(db.name) as DBName, rtrim(hostname) as HostName,	rtrim(program_name) as ProgramName, rtrim(nt_domain) as Domain,	rtrim(nt_username) as UserName,	rtrim(net_address) as MACAddress,	rtrim(loginame) as LoginNamefrom master..sysprocesses spjoin master..sysdatabases db	on sp.dbid = db.dbidcross join master..sysservers sswhere sp.loginame &lt;&gt; 'sa'order by db.name, hostname, loginame[/code]then wrote it to a text file.  She ran it at the top of the hour, on some days every 5 or 15 minutes, over an extended period of time and collected the scripts on her machine via a scheduled task that ran at 5 minutes after the hour that did this:[code]copy C:\SQLUserStats\ConnectionStats.txt + \\server1\c$\SQLUserStats\sqluserstats.txt C:\SQLUserStats\ConnectionStats.txtcopy C:\SQLUserStats\ConnectionStats.txt + \\server2\c$\SQLUserStats\sqluserstats.txt C:\SQLUserStats\ConnectionStats.txtetc.[/code]Worked like a charm.  Suck the text file into a table and you can slice and dice the data to your heart's contentment.One thing it would not show: if connections came through a gateway or application server that could spoof a MAC address or user name, you could have several dozen users hidden that you won't readily see.  You also wouldn't see users who logged in for less than an hour and didn't cross that top of the hour boundary, so there were days that it ran every 15 minutes or every 5 minutes.  Still, it was deemed adequate by her management to give a reasonable number of user connections.Regardless, sysprocesses saved a whole lot of work for her.</description><pubDate>Tue, 05 May 2009 11:24:01 GMT</pubDate><dc:creator>Wayne West</dc:creator></item><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>What a co-incidence...On thursday, I was struggling to get the Detailed information for each column in sys.sysprocesses. And here we are.... Very useful article, especially for me. Thanks</description><pubDate>Mon, 04 May 2009 00:12:15 GMT</pubDate><dc:creator>Atif-ullah Sheikh</dc:creator></item><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>Hi Mark,Thanks Andrew and Sanjay.The sysprocesses table is wrapped by sp_who* and the activity monitor but they do not give you as much detail, if you look at the definition for sp_who it is:[code]CREATE PROCEDURE sys.sp_who &lt;snip /&gt;select spid,	   ecid,	   status,       loginame=rtrim(loginame),	   hostname,	   blk=convert(char(5),blocked),	   dbname = case					when dbid = 0 then null					when dbid &lt;&gt; 0 then db_name(dbid)				end	   ,cmd	   ,request_idfrom  master.dbo.sysprocesseswhere spid &gt;= @spidlow and spid &lt;= @spidhigh[/code]so it is useful but I think when troubleshooting issues knowing how to use sysprocessses and what everything means is essential.  It is also good for scripting because for instance you can join against itself on blocked = spid to get information on what queries are being blocked and also what it is that is blocking them.Ed</description><pubDate>Fri, 01 May 2009 10:42:10 GMT</pubDate><dc:creator>edwardelliott</dc:creator></item><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>Good review of sysprocess table.  Every DBA should know about this table.  Though I know a couple of ones who are used to using [b]sp_who2[/b] but does have no idea where the data comes from.2005 and 2008 has an extra column request_id.</description><pubDate>Fri, 01 May 2009 07:44:35 GMT</pubDate><dc:creator>SanjayAttray</dc:creator></item><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>Thanks for a great review.  For those of us who have been using sysprocesses as well as sp-who, sp_who2 for along time, it never hurts to have a review.  BTW.. sp_who &amp;  sp_who2 use info from sysprocesses.  sysprocesses goes back to the original Sybase design, so it has been around for a while.</description><pubDate>Fri, 01 May 2009 07:20:37 GMT</pubDate><dc:creator>Andrew Peterson-472853</dc:creator></item><item><title>RE: What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>Question - how does this relate to sp_who and sp_who2, and the activty monitor in SSMS?</description><pubDate>Fri, 01 May 2009 04:59:39 GMT</pubDate><dc:creator>SuperDBA-207096</dc:creator></item><item><title>What is sysprocesses and what can it do for you?</title><link>http://www.sqlservercentral.com/Forums/Topic708252-1451-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/System+Tables/66335/"&gt;What is sysprocesses and what can it do for you?&lt;/A&gt;[/B]</description><pubDate>Thu, 30 Apr 2009 22:59:51 GMT</pubDate><dc:creator>edwardelliott</dc:creator></item></channel></rss>