May

1

Change the Default Database for a User in SQL Server

Posted by Leave a Comment

Here are three easy ways to change the default database for a user in SQL Server.

Option 1: Execute the system stored procedure sp_defaultdb

EXEC sp_defaultdb @loginame='UserName', @defdb='NewDefaultDB'

Option 2: SSMS Login Properties

  1. Connect to the database and open the Object Explorer
  2. Expand the Logins folder under the Security folder
  3. Right-click the username and select Properties
    SSMS Object Explorer
  4. Under the General section, select the desired database from the Default Database drop-down list
    SSMS Login Properties

Option 3: SSMS Facets Properties

  1. Connect to the database and open the Object Explorer
  2. Expand the Logins folder under the Security folder
  3. Right-click the username and select Facets
    SSMS Object Explorer
  4. In the Facet Properties section change the Default Database value to the desired database name
    SSMS Facets Properties

Category: Development, SQL, SQL Server, SSMS

Leave a Reply