select distinct 连接的用户名=loginame from master..sysprocesses where hostname='' and dbid=db_id(N'你要查询的库名')