| Author |
Topic  |
|
|
cddot
Starting Member
37 Posts |
Posted - 02/11/2009 : 02:23:35
|
Selecting this menu option, I am prompt to login so I click Connect to login, but I get this error when trying to run a query:
Msg 208, Level 16, State 1, Line 1 Invalid object name 'mytab1'.
I can query the table fine if I start with a New Query. What else do I need to do?
This is SQLServer 2005. |
Edited by - cddot on 02/11/2009 02:27:43
|
|
|
sunitabeck
Flowing Fount of Yak Knowledge
5152 Posts |
Posted - 02/11/2009 : 02:55:17
|
| Probably because you are running the query against master database. When you make the new connection, you will be connected to the server with your default database selected, which may be master database or another database. |
 |
|
|
cddot
Starting Member
37 Posts |
Posted - 02/11/2009 : 03:20:49
|
| That would be it. Next question, where/how can I change the default connection? |
 |
|
|
sunitabeck
Flowing Fount of Yak Knowledge
5152 Posts |
Posted - 02/11/2009 : 03:48:39
|
ALTER LOGIN loginNameHere WITH DEFAULT_DATABASE=databaseNameHere
or, if you are using SQL 2005, in SQL Management Studio, in object explorer, under server->security->logins, right click on the user name and select properties. There will be a drop down where you can change the default database. |
 |
|
|
cddot
Starting Member
37 Posts |
Posted - 02/11/2009 : 04:38:49
|
| Thank you. |
 |
|
| |
Topic  |
|