Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Cannot open user default database. Login failed

Author  Topic 

vladkara2100
Starting Member

1 Post

Posted - 2010-06-09 : 16:18:09
I have an iteresting problem that I do not see any answer to:

On my home computer, I have SQLEXPRESS 2005. I am also working with SQL production server 2005. So the problem applies equally to both.
At home, I can log into the computer either as a (hidden) administrator, or as a user with administrator rights.

Statement #1:
bcp "PHInterface.dbo.STD_Trans" out D:\STD_VB\Test_Data\STD_Trans03.tds -n -SVLADIMIR20-PC\EXP2005NEW -T -q -k

Statement #2:
bcp "SELECT * from PHInterface.dbo.STD_Trans where ZP1_PtMedRecID = '7X-141194'" queryout D:\STD_VB\Test_Data\STD_Trans_SP1.tds -n -SVLADIMIR20-PC\EXP2005NEW -T -q -k

Problem: the STMT#1 runs equally well on all computers and under any user with rights. The problem is with the STMT#2. It will not run at my work production machine, giving miscellaneous error messages. At home, I am getting message: Cannot open user default database. Login failed. SQLState = 28000, NativeError = 18456 and also, Login failed for user 'Vladimir20-PC\Administrator'.
However, if the same statement is executed under logged-in (into windows) for different user with administrator privillages, the STMT#2 works fine.

Thus, I cannot execute the STMT#2 on my production server, since I have only one user account there.

WHAT IS THE PROBLEM!!!!!!!!!!!!!!!

The server (at home) was installed under administrator and administrator is the owner.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-09 : 17:21:08
You need to fix the default database for the account that is giving you the error. Switch it to master for example.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -