Monday, November 12, 2007

Getting User Session information in SQL server 2005

In SQL server 2005 if you want to check all SQL server sessions following is the command for viewing this;

1 . select * from sys.dm_exec_sessions

But the above command will show the user sessions and as well as the system sessions, if you want to only see the user connections then following is the command;

2. select * from sys.dm_exec_connections

you can also get the session id from the below command and match it with the session_id column of the 2 or 1 command for viewing the specific session information.

3. Select @@SPID

5 comments:

@rnab said...

Thx...

Can we kill any session or connection ?

Khurram Ullah Khan said...

Yes you can, following is the link for details

http://msdn.microsoft.com/en-us/library/ms173730(SQL.90).aspx

Anonymous said...

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

Unknown said...

can we check who are connected to OLAP cube 2005?

Anonymous said...

Great Post. Qasim