select * from master.dbo.sysprocesses where dbid in (select dbid from master.dbo.sysdatabases where name = 'pics_test')