Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_setapprole

  No additional text.


Syntax
create procedure sys.sp_setapprole
    @rolename   sysname,        -- name app role
    @password   sysname,		-- password for app role
	@encrypt	varchar(10)	= 'none', 		-- Encryption style ('none' | 'odbc')
	@fCreateCookie bit = 0,
	@cookie varbinary(50) = 0xFFFFFFFF OUTPUT
as
    -- SETUP RUNTIME OPTIONS / DECLARE VARIABLES 
	set nocount on

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

	-- CHECK PARAMETER
	if (@rolename is null)
    begin
        raiserror(15431,-1,-1)
        return (1)
    end

	-- VALIDATE ENCRYPTION
	declare @encrStyle int
	select @encrStyle = case lower(@encrypt) when 'none' then 0 when 'odbc' then 1 else null end
	if (@encrStyle is null)
	begin
        raiserror(15600,-1,-1,'sys.sp_setapprole')
        return (1)
	end

    -- SP MUST BE CALLED AT ADHOC LEVEL 
    if (@@nestlevel > 1)
    begin
        raiserror(15422,-1,-1)
        return (1)
    end

    -- ACTIVATE APPROLE (THIS IS ONLY VALID FROM THIS SP!) 
    if (@fCreateCookie = 1)
		setuser @rolename, @password, @encrStyle, @cookie
    else
		setuser @rolename, @password, @encrStyle

    -- RETURN SUCCESS/FAILURE 
    if (@@error <> 0)
        return (1)
    return (0)	-- sp_setapprole

 
Last revision 2008RTM
See also

  sp_unsetapprole (Procedure)
       



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