现在的位置: 首页 > 综合 > 正文

查看SQL Server数据库当前连接数

2013年07月07日 ⁄ 综合 ⁄ 共 282字 ⁄ 字号 评论关闭

一 查询数据库的连接数

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

DBNAME为查询的数据库名称,记录行数为该数据库的连接数。


二 查询用户的连接数

exec SP_WHO 'username'

记录行数为该用户的连接数

外键约束级联更新和删除

alter table xxx
   add constraint FK_xxx foreign key (xxId)
      references xxx(xxId)
         on update cascade on delete cascade

抱歉!评论已关闭.