When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

.Net Developer
Professional Technical Resources
US-WA-Bellingham

Justtechjobs.com Post A Job | Post A Resume

Published: Thursday, July 15, 1999

Just What is SQL Doing?
By Julian


Have you ever wondered what in the hell SQL server is doing at any given moment? Wouldn't it be nice to be able to view the inner workings of SQL at any point in time from the web? Well, it's quite possible.

- continued -

The trick, is to query the sysprocesses table. This tip, from Julian Sitkewich queries the sysprocesses table, showing us minute information on connections, statuses and processes running or sleeping on the server!

All we have to do is create a simple ASP page and paste the following code into it:

<% Dim conn Set conn = Server.CreateObject("ADODB.Connection") conn.Open "DSN=pubs" 'Use you own connection string here! 'Create a recordset and query sysprocesses Dim rs Set rs = Server.CreateObject("ADODB.Recordset") rs.Open "SELECT * FROM master..sysprocesses WHERE hostname <> ''", conn 'We query where hostname is NOT empty, so that we get the listing of 'user processes, not system processes. %> <HTML> <BODY> <TABLE border=1> <TR> <% For i = 0 to rs.Fields.Count - 1 %> <TH> <FONT SIZE=2> <%=rs.Fields(i).Name </FONT> </TH> <% Next %> </TR> <% Do While Not rs.EOF %> <TR> <% For i = 0 to rs.Fields.Count - 1 %> <TD> <FONT SIZE=2> <=rs(i)%></FONT> </TD> <% Next %> </TR> <% rs.MoveNext
Loop %> </TABLE> </BODY> </HTML> <%
'Always important, clean up time!!
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
%>

So, what does this code do? Well, it's pretty straight forward, I think. It first creates a connection object and connects to the database of your choice. Next, a recordset object is created and a query on sysprocesses is performed. This recordset object is then displayed in a table. Not much to it, really. Simple, yet powerful.

Be sure to try it out, and see SQL's current status! :)


Julian is a software developer who currently spending his time developing a web-based project management software using Java. Most of his experience is in the e-commerce/Internet development arena and prefers to develop with Java, ASP, JSP, XML, Oracle, SQL Server, and UNIX (in no particular order). Previous to his current endeavors, Julian worked for an online learning company where he designed and implemented a large, distributed online learning application.


Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES