欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

非常实用的MSSQL语句

程序员文章站 2022-04-24 10:29:42
  1.查询的内存   sql_get_memory ='select name, value, value_in_use, [description] from sys...

  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"