April 22, 2012

sp_droprolemember (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_droprolemember(nvarchar @rolename
, nvarchar @membername)

MetaData:

 create procedure sys.sp_droprolemember  
@rolename sysname,
@membername sysname
AS
-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --
set nocount on
declare @ret int, -- return value of sp call
@stmtR nvarchar(4000)

-- Was a part of check to prevent inside a user Xact. Leave for backward compat.--
set implicit_transactions off

exec @ret = sys.sp_validname @rolename
if @ret <> 0
return(1)

exec @ret = sys.sp_validname @membername
if @ret <> 0
return(1)

set @stmtR = 'alter role '
set @stmtR = @stmtR + quotename(@rolename, ']')
set @stmtR = @stmtR + ' drop member '
set @stmtR = @stmtR + quotename(@membername, ']')

-- issue DDL to create the role --
exec (@stmtR)
if @@error <> 0
begin
return (1)
end

-- RETURN SUCCESS --
return (0) -- sp_droprolemember

No comments:

Post a Comment

Total Pageviews