Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Viewing SQL currently being ran

Author  Topic 

kloid
Starting Member

3 Posts

Posted - 2008-04-02 : 23:28:48
Hi all,

I'm very new to SQL Server having previously worked with Oracle 10g for the last couple of years.

Anyway, in Oracle there is a view called V$SQL that provides information about SQL that is or has recently been executed. I'm trying to find a similar sort of functionality in SQL Server.

Basically, what I'd like to do is list all of the SQL statements that are running at a given moment. Or even better would be a way of listing all statements that have run in the last 10 minutes.

Appreciate any help for a newbie.

We're on SQL Server 2000 8.00.194

Cheers
Kloid

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-02 : 23:31:37
Try 'dbcc inputbuffer(spid)'.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-04-02 : 23:33:22
go to activity monitor :you will see everything including queries
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-02 : 23:38:43
Have to double click on each process to view query.
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-04-02 : 23:41:59
also have a look at profiler - you can run a trace and it will record all statements executed, as well as other types of events.


elsasoft.org
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-04-02 : 23:43:22
Not a good idea to run profiler just to watch queries.
Go to Top of Page

kloid
Starting Member

3 Posts

Posted - 2008-04-03 : 00:01:07
OK, thanks for the replies so far.

Where can I find Activity Monitor? I'm currently looking at the database using SQL Query Analzyer.

Thanks
Kloid
Go to Top of Page

kloid
Starting Member

3 Posts

Posted - 2008-04-03 : 00:23:23
Never mind. I found the information I was looking for in the syscacheobjects table in the Master database.

Thanks
Kloid
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-03 : 23:30:38
Not exact same, and sql may not cache all queries due to cache size. By the way, activity monitor in in sql2k5 only. For sql2k, you can find current processes under management in enterprise manager.
Go to Top of Page
   

- Advertisement -