Unable to open the user default database, logon failed, which is one of the problems that SQL Server users are familiar with. When using Enterprise Manager, Query Analyzer, various kinds of tools and application software, as long as the connection to the SQL Server database, it is possible to encounter this problem, causing this error occurred more than the reason, let us analyze the cause of the problem and the solution.
First, why
The default database for the login account is deleted.
Second, the solution:
(a), using the Administrator account to modify the default database for this account
1, open Enterprise Manager, expand the server group, and then expand the server
2. Expand "Security", expand Login, right-click the corresponding login account, select from the pop-up menu, properties
3. Re-select the default database for this login account
--No login, no security node seems to be able to open.
(b), if there is no other administrator login account, can not be modified in Enterprise Manager, using the isql command line tool
isql/u "sa"/P "sa password"/d "master"//"EXEC sp_defaultdb n ' sa ', n ' master '"
If you use Windows authentication method, use the following command:
isql/e/d "Master"/q "exec sp_defaultdb n ' builtin/administrators ', n ' master '"
Reference: Microsoft Chinese Knowledge Base article: How to troubleshoot connection problems in SQL Server 2000
Address: http://support.microsoft.com/default.aspx?scid=kb; zh-cn;827422
------------
This error generally occurs as follows:
Import a database into the MS SQL database, in Enterprise Manager, all Tasks-> restore the database-> Select Restore from device, locate the database file "Xxx.db", import.
Error: Device activation errors, please use the WITH MOVE option to flag the valid location of the file.
Workaround: Right-click Database (Note that is not a particular database)-> All Tasks-> Restore the database-> Select Restore from Device, select the name of the database you want to revert to, and then in the tab, select the mandatory restore database on the existing database. Then in the following changes to the physical path of the database restore, this path if there is a path, otherwise there will be the above error, logical file name can not be changed.
--------------
is available only if you are logged on by a user with a different default database. [--default database for individual users]
Edit SQL Server registration, change to SQL Server authentication, and log on with SA the default database for the
SA can be detached-> SQL Server.