Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I changed my SQL server options so the specific DB
is the default DB and the other day I detatched the DB for some reason
and know I can't connect to my SQL server because its
looking for that specific DB that I detatched.

When I press the connect button in SQL Server Management Studio
it gives me this error: And doesn't connect
CSS
Connect to Server

Cannot connect to BEN-PC.

ADDITIONAL INFORMATION:

Cannot open user default database. Login failed.
Login failed for user 'BEN-PC\Ben'. (Microsoft SQL Server, Error: 4064)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=4064&LinkId=20476


Please help what can I do?
Posted
Updated 23-Jan-12 22:02pm
v2

Go to SQL Server Management Studio.
Log in as normal, then right click "Databases" in the Left hand pane ("Object explorer").
Select "Attach..." and follow the dialogs.
 
Share this answer
 
Comments
Ben Paxton 24-Jan-12 3:54am    
Thats just the problem I can't connect as normal. It shows an error
OriginalGriff 24-Jan-12 4:01am    
No, just run SSMS - not your application. All it requires is your usual log in (which needs no specific database). You can then reconnnect the DB.
You do not need to connect to a DB just to log in to SSMS
Ben Paxton 24-Jan-12 4:04am    
I changed the logging settings of SSMS and set a deafualt DB
OriginalGriff 24-Jan-12 4:07am    
When you get the log in screen, Press the "Options" button - you should be able to change the default DB from there.
Ben Paxton 24-Jan-12 4:10am    
I did try that aswell. It shows a message box asking to connect to SQL server management studio. If I press "Yes" it just shows once again that it can't connect and when I press "No" nothing happens
Quote:
http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/

http://www.c-sharpcorner.com/uploadfile/raj1979/how-to-attach-a-database-in-sql-server-2005/

http://www.packtpub.com/article/moving-a-database-from-sql-server-2005-to-sql-server-2008-in-three-steps

http://www.mssqltips.com/sqlservertip/1894/attach-a-sql-server-database-with-a-missing-transaction-log-file/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900