The default database of the SQL Server logon account is deleted.

Source: Internet
Author: User

SQL Server 2005

In SQL Server 2005, you can use the sqlcmd utility to change the default database. To do this, follow these steps: ◆ 1. Click Start, click Run, type cmd, and then press Enter.

◆ 2. use one of the following methods based on the type of authentication used for SQL Server login: • If SQL Server login uses Microsoft Windows Authentication to connect to this instance, type the following at a command prompt, then press Enter:

The code is as follows: Copy code

Sqlcmd-E-S InstanceName-d master

• If you log on to SQL Server and use SQL Server authentication to connect to this instance, type the following in a command prompt and press Enter:

The code is as follows: Copy code

Sqlcmd-S InstanceName-d master-U SQLLogin-P Password

Note: InstanceName is a placeholder for the name of the SQL Server 2005 instance to be connected. SQLLogin is a placeholder for deleting the SQL Server logon of its default database. Password is a placeholder for the SQL Server login Password.

◆ 3. At the sqlcmd prompt, type the following content and press Enter:

The code is as follows: Copy code

Alter LOGIN sa WITH DEFAULT_DATABASE = master

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.