sql server中的一些角色,命令,函式的講解

2021-07-23 13:03:42 字數 1308 閱讀 1785

今天悲劇了,把資料庫中的使用者設定成了db_denydatareader角色,沒有sa的密碼,找了好久。可以使用系統儲存過程將使用者從中移除

exec sp_droprolemember 'db_denydatareader', 'mssql_nlts';

下表說明了用於伺服器級角色的命令、檢視和函式。 功能 型別 說明  

 sp_helpdbfixedrole (transact-sql)   →  元資料   →  返回固定資料庫角色的列表。  

 sp_dbfixedrolepermission (transact-sql)   →  元資料   →  顯示固定資料庫角色的許可權。  

 sp_helprole (transact-sql)   →  元資料   →  返回當前資料庫中有關角色的資訊。  

 sp_helprolemember (transact-sql)   →  元資料   →  返回有關當前資料庫中某個角色的成員的資訊。  

 sys.database_role_members (transact-sql)   →  元資料   →  為每個資料庫角色的每個成員返回一行。  

 is_member (transact-sql)   →  元資料   →  指示當前使用者是否為指定 microsoft windows 組或 microsoft sql server 資料庫角色的成員。   create role (transact-sql)   →  命令   →  在當前資料庫中建立新的資料庫角色。  

 alter role (transact-sql)   →  命令   →  更改資料庫角色的名稱。   drop role (transact-sql)    →  命令從資料庫中刪除角色。  

 sp_addrole (transact-sql)   →  命令   →  在當前資料庫中建立新的資料庫角色。  

 sp_droprole (transact-sql)   →  命令   →  從當前資料庫中刪除資料庫角色。  

 sp_addrolemember (transact-sql)   →  命令   →  為當前資料庫中的資料庫角色新增資料庫使用者、資料庫角色、windows 登入名或 windows 組。   

sp_droprolemember (transact-sql)   →  命令   →  從當前資料庫的 sql server 角色中刪除安全帳戶。 

public 資料庫角色 

每個資料庫使用者都屬於 public 資料庫角色。如果未向某個使用者授予或拒絕對安全物件的特定許可權時,該使用者將繼承授予該物件的 public 角色的許可權。

SQL server中的一些的操作

提取日期中的年月日 declare dev int,len int,i int 1,date char 10 day int,month int set date convert char 10 dateadd dd,1,getdate 120 print date select day datep...

sqlServer 一些常用的

1.插入資料 insert into t casename name,plantid,factoryid,mouldclassid,casequery values 旋轉蓋 1,1,297,8 2.表中新增字段 alter table table name add column name datat...

SQL Server 一些技巧

keylife富翁筆記 作者 hongyuan 標題 sql server 一些技巧 關鍵字 分類 sql server 2000 密級 私有 評分 回覆 0,閱讀 4 1 重置 identity 欄位的起始值 dbcc checkident table name reseed,0 2 壓縮資料庫 ...