Showing posts with label Sql 2008. Show all posts
Showing posts with label Sql 2008. Show all posts

Thursday, December 25, 2008

Sql Server 2008 Error Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

Very strange. I was trying to attach a database using my 'sa' account which was detached before with some other account. I got this error.

-----------------------------------------------------------------------------------------
TITLE: Microsoft SQL Server Management Studio
------------------------------

Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

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

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create the physical file  (Microsoft SQL Server, Error: 5123)

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

------------------------------
BUTTONS:

OK
------------------------------

Finally, I opened another instance of SQL Management studio and used my regular windows authenticated account to attach and it worked magically.

I understood the reason after it. Basically the 'sa' account is the Sql server account which need not have access to my File system. So it is obvious !

Wednesday, December 24, 2008

Sql Server Cannot open user default database. Login failed

This may help a few people. I was trying to connect to SQL Server 2008 from my VS 2008 and suddenly it could not list any databases from my server. I had Enterprise edition. I believe the same problems can occur in any versions of SQL Server be it Express, Standard or WorkGroup editions.

The exact error message was Cannot open user default databaseLogin failedLogin failed for user '' , Error Number 4064.

After a lot of google search which could not actually point to my actual problems, I found it myself.

 We basically need to specify the default database for the user login. If not, then we won't be able to login. 

  But one problem here is that we need some other account either "sa" or some other admin account to change this setting. This setting is found at Sql Management Studio --> Security --> Logins --> Double click on the user name..

 Hope someone finds this useful.