select * from sysprocesses where dbid in (select dbid from sysdatabases where name='dbname')

相关文章: