sp_defaultdb (Transact-SQL)
SQL Server 2005
Changes the default database for a Microsoft SQL Server login.
Important: |
|---|
| This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER LOGIN instead. |
Transact-SQL Syntax Conventions
- [ @loginame=] 'login'
-
Is the login name. login is sysname, with no default. login can be an existing SQL Server login or a Windows user or group. If a login for the Windows user or group does not exist in SQL Server, it is automatically added.
- [ @defdb=] 'database'
-
Is the name of the new default database. database is sysname, with no default. database must already exist.
sp_defaultdb calls ALTER LOGIN. This statement supports additional options. For information about changing default database, see ALTER LOGIN (Transact-SQL).
sp_defaultdb cannot be executed within a user-defined transaction.