Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Can't set default DB properly.

$
0
0

Hi

I have been using SQL Server 2012 SP2 for about 12 months.  I had to reinstall about 6 months ago and my default DB setting was lost (was working previously).  I have tried to set the default DB by running the following.

Exec sp_defaultdb @loginame='Macbook\Matt',@defdb='myDB'

When I navigate to Security\Logins\Macbook\Matt\General  I can clearly see myDB showing as the default.

When I am in SSMS in myDB and click "New Query", the default DB selected is myDB.  But when I right click on a table in myDB and select top 1000 rows, a query is created but the database selected is master and not myDB as expected.

Can anyone suggest a way to solve this so that myDB is selected when I right click and create a query from a table in myDB?


Viewing all articles
Browse latest Browse all 7129

Trending Articles