ALTER DATABASE SCOPED CREDENTIAL#
Changes the identity and secret of an existing database scoped credential in the current virtual database.
Syntax#
Arguments#
credential_name
The name of the existing credential to change (at most 128 characters). Altering a credential that does not exist raises an error.
IDENTITY = ‘identity_name‘
The new identity. See CREATE DATABASE SCOPED CREDENTIAL for the reserved identity values.
SECRET = ‘secret‘
The new secret. Optional.
Remarks#
ALTER replaces both the identity and the secret. If SECRET is omitted, the stored secret is cleared (set to
NULL) — this matches SQL Server. The secret is protected at rest and is never shown in clear text.
Clearing the secret does not unbind the credential from its consumers: a consumer that matches the credential by name still selects it, now without a key. A database scoped credential that names an AI provider endpoint also outranks the server-level default for its database, so clearing its secret makes that database’s AI calls fail with an error naming the credential, while other databases keep working. See qua_add_external_ai_model.
Permissions#
Requires the connection-management permission (CreateConnection) on the server.
Examples#
Reset the identity and secret of AppCred:
ALTER DATABASE SCOPED CREDENTIAL AppCred
WITH IDENTITY = 'reporting_user2', SECRET = 'new-secret';