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.
| Author |
Topic |
|
cddot
Starting Member
37 Posts |
Posted - 2009-02-11 : 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 1Invalid 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. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2009-02-11 : 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 - 2009-02-11 : 03:20:49
|
| That would be it. Next question, where/how can I change the default connection? |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2009-02-11 : 03:48:39
|
| ALTER LOGIN loginNameHere WITH DEFAULT_DATABASE=databaseNameHereor, 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 - 2009-02-11 : 04:38:49
|
| Thank you. |
 |
|
|
|
|
|
|
|