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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sys.database

Author  Topic 

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-05-19 : 08:10:08
i have query to list spid and kill process in sql 2000.

SELECT @spid = A.SPID
FROM MASTER..SYSPROCESSES A
JOIN
MASTER..SYSDATABASES B
ON A.DBID=B.DBID
AND B.NAME=@DBNAME
AND A.SPID <> @@spid


kill @spid

this has to convert in sql 2005 if anything harm...

here i have used MASTER..SYSDATABASES and MASTER..SYSPROCESSES . in sql 2000 it refer master database and retrieve the spid. but in sql 2005 sys.database list all database even if we execute it from user defined database.
shall i use the same sql 2000 script ( MASTER..SYSDATABASES and MASTER..SYSPROCESSES . ) or i shud use view sys.database .

anything harm using this sql 2000 script in sql 2005

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-05-20 : 22:40:31
You can use sys.sysdatabases and sys.sysprocesses in sql2k5.
Go to Top of Page
   

- Advertisement -