赛捷软件论坛's Archiver

erina.pan 发表于 2018-6-13 14:28

非常实用的MSSQL语句

1.查询数据库的内存

  SQL_GET_MEMORY ='SELECT name, value, value_in_use, [description] FROM sys.configurations WHERE name = "max server memory

  (MB)" ORDER BY name OPTION (RECOMPILE)'

  2.查询用户权限,SERVER级别

  SQL_GET_USER_RIGHT_SERVER = "SELECT * FROM sys.fn_my_permissions(NULL, 'SERVER')"

  3.查询用户权限,DATABASE级别

  SQL_GET_USER_RIGHT_DB = "SELECT * FROM sys.fn_my_permissions(NULL, 'DATABASE')"

  4.切换数据库主备关系

  SQL_CHANGE_MASTER = "alter database elbert08 set partner failover"

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.