Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_dropapprole

  No additional text.


Syntax
create procedure sys.sp_dropapprole
    @rolename       sysname     -- role to be dropped
as
    -- SETUP RUNTIME OPTIONS / DECLARE VARIABLES 
	set nocount on
	declare @ret        int,
			@stmtR		nvarchar(4000)

    -- DISALLOW USER TRANSACTION 
	set implicit_transactions off
	if (@@trancount > 0)
	begin
		raiserror(15002,-1,-1,'sys.sp_dropapprole')
		return (1)
	end

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

	-- create statement
	set @stmtR = 'drop application role ' + quotename(@rolename, ']')

	BEGIN TRANSACTION

	-- this will drop the schema owned by the approle that has the same name as the approle,
	-- if such schema exists
	EXEC %%Owner(Name = @rolename).DropSchema(OwnerType = 3)
	if @@error <> 0
	begin
		ROLLBACK TRANSACTION
		-- error message comes from inside the invoke
		return (1)
	end

	-- drop the owner
	exec (@stmtR)
	if @@error <> 0
	begin
		ROLLBACK TRANSACTION
		-- error message comes from inside the statement
		return (1)
	end

	COMMIT TRANSACTION

    -- RETURN SUCCESS 
    return (0) -- sp_dropapprole

 
Last revision 2008RTM
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash