--创建登录账户use masterGOEXEC sp_addlogin 'jacky', 'pwd'--EXEC sp_droplogin 'jacky' --删除登陆账户 use TestDBGO--创建数据库用户EXEC sp_grantdbaccess 'jacky'GO--drop schema [jacky] --删除架构--drop user jacky --删除数据库用户 --指定的数据库赋权限grant select on database::TestDBto jackywith grant option --指定表赋查询权限grant select,insert on tbl_all_CommonEnumList to jackyGO/*grant select on table:: tbl_all_CommonEnumList to jackyWITH GRANT OPTIONGO*/--指定function查询权限grant selecton object::dbo.FNLY_GetEnumNameto jackywith grant optiongrant execon object::stp_sys_SelectTableto jackywith grant option/*grant execon object::sp_helptextto jackywith grant option*/--查询当前登陆用户select USER_NAME()select CURRENT_USER as 'CurrentLoginUser'
注:赋exec权限后,即使没有delete/update权限,在proc中有delete/update代码,依然可以正常执行