A connection could not be established to (LOCAL).
Reason: Cannot open user default database. Login failed.
Please verify SQL Server is running and check your SQL Server registration
properties (by right clicking on the LOCAL node) and try again).
I get this whenever I right-click on LOCAL.
Apparently you at some point set your default database, the one you connect
to when you login, but that database does not exist anymore.
Open a command-line window, run
osql -S . -E -d tempdb
And then run:
EXEC sp_defaultdb 'yourlogin', 'tempdb'
Notes:
1) I assume here that you run OSQL on the SQL Server machine itself,
and you have a default instance. You may instead have to specifyu
your server as MACHINE\INSTANCE - it's the same as you use in
Enterprise Manager.
2) I assume here that you use Windows Authentictaion (-E). Use -U and
-P to specify username and password if you use SQL authentication.
3) "yourlogin" is of course a placeholder for your real login name.
--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
"Carl Gross" <Carl...@discussions.microsoft.com> wrote in message
news:E8A868B5-0092-4B2B...@microsoft.com...
"Erland Sommarskog" wrote:
> .
>
"Erland Sommarskog" wrote:
> .
>
Exactly what does "didn't work" mean? On which point in this procedure
did it fail?
The problem is that your default database does not exist, so this needs
to be addressed.
I include the procedure again:
1>
and I type in the EXEC command like this:
1> EXEC sp_default 'mylogin(I use my admin user name)', 'tempdb'
after that I get:
2>
I have to type EXIT or type ctrl-C to get out of the SQL editor. By
"nothing happens" I mean that I try to look at the databases and get the same
error as I did before the error, as though I didn't type the command prompt
code you gave me. Am I missing something that might execute the osql line I
typed in?
"Erland Sommarskog" wrote:
> .
>
Yes, you need to type "go" to tell OSQL to send the command batch to SQL
Server. Sorry, that I failed to mentioned that.
I typed in every admin username and admin password in my arsenal with no
effect (after the EXEC command I typed "go" and got results).
I tried the following command:
EXEC sp_defaultdb 'sa', 'tempdb'
and got the following response:
Default database changed. Still can't get into LOCAL SQL Server Group. Did
I type in the wrong parameter?
"Erland Sommarskog" wrote:
> .
>
Is there a default that MS uses when its first installed?
"Erland Sommarskog" wrote:
> .
>
In that case you should do
EXEC sp_defaultdb 'YOURDOMAIN\YOURLOGIN', 'tempdb'
> Is there a default that MS uses when its first installed?
How good would that be for performance?
But there is the Dedicated Admin Connection you can use when there is
no other way to connect.
Also, by default SQL authentication is disabled, so if you never enabled
it, it's off.
Msg 15007, Level 16, State 1, Server SCAPCADC, Procedure sp_defaultdb, Line 44
The login 'DOMAIN\ADMINUSER' does not exist.
Is there something else I could try?
"Erland Sommarskog" wrote:
> .
>
When you are logged in, run this query:
SELECT system_user
And as login specify what it returns.