The user default database could not be opened and the login failed because the default database for the login account was deleted.
The workaround is to use the Administrator account to modify the default database for this login account.
1. Log in to Enterprise Manager using the Administrator account, in Object Explorer, expand Security--"Login name", right-click the account and click "Properties"
2. In the "Login Properties" dialog box, change the default database to the right of the first General tab interface.
If the problem is your administrator account, you cannot log in to the Enterprise Manager to modify, you can use the following command,
SQL Server 2000 users open the CMD command prompt and use the following command:
SQL Account Login mode: isql-u "password"-P "jtydl"-D "master"-Q "exec sp_defaultdb n ' sa ', n ' master '"
Windows Authentication Login mode: ISQL-E-D "Master"-Q "exec sp_defaultdb n ' builtin/administrators ', n ' master '"
SQL Server 2005 users cannot use the isql command because there is no isql in the SQL 2005 version, and the Internet is reproduced isql usage without saying that there is no such command in SQL 2005, the problem
It bothered me for half an hour and finally found it, SQL2005 but a new sqlcmd command was added to replace isql. Just change the above isql to SQLCMD, also at the cmd command prompt
Face input.
The general reason for this error:
1, mistakenly deleted the default database.
2. The default database is restored by using a different physical path to back up the database, which may cause the above error.