ALTER APPLICATION ROLE (Transact-SQL)
Changes the name, password, or default schema of an application role.
ALTER APPLICATION ROLE application_role_name WITH <set_item> [ ,...n ] <set_item> ::= NAME = new_application_role_name | PASSWORD = 'password' | DEFAULT_SCHEMA = schema_name
Is the name of the application role to be modified.
Specifies the new name of the application role. This name must not already be used to refer to any principal in the database.
Specifies the password for the application role. password must meet the Windows password policy requirements of the computer that is running the instance of SQL Server. You should always use strong passwords.
Specifies the first schema that will be searched by the server when it resolves the names of objects. schema_name can be a schema that does not exist in the database.
If the new application role name already exists in the database, the statement will fail. When the name, password, or default schema of an application role is changed the ID associated with the role is not changed.
Application roles are visible in the sys.database_principals catalog view.
Requires ALTER ANY APPLICATION ROLE permission on the database. To change the default schema, the user also needs ALTER permission on the application role. An application role can alter its own default schema, but not its name or password.
The following example changes the name of the application role
USE AdventureWorks2012; CREATE APPLICATION ROLE weekly_receipts WITH PASSWORD = '987Gbv8$76sPYY5m23' , DEFAULT_SCHEMA = Sales; GO ALTER APPLICATION ROLE weekly_receipts WITH NAME = receipts_ledger; GO
The following example changes the password of the application role
ALTER APPLICATION ROLE receipts_ledger WITH PASSWORD = '897yUUbv867y$200nk2i'; GO
The following example changes the name, password, and default schema of the application role
receipts_ledger all at the same time.
ALTER APPLICATION ROLE receipts_ledger WITH NAME = weekly_ledger, PASSWORD = '897yUUbv77bsrEE00nk2i', DEFAULT_SCHEMA = Production; GO