| Author |
Topic |
|
DOlivastro
Starting Member
41 Posts |
Posted - 2004-06-03 : 10:51:34
|
| When I start Query Analyzer, I have to pick a server. When I pick the server, I am immediately connected to a given database, but it is not the one I want. I imagine the default database can be set somewhere, but I can't seem to find it.Any help?Dom |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-03 : 11:01:23
|
| It's your default database in your login for the particular server... |
 |
|
|
DOlivastro
Starting Member
41 Posts |
Posted - 2004-06-03 : 11:09:55
|
| Thanks. Worked like a charm. BTW, answers could be a little more complete. You didn't even mention that this was not done in QA, but in EM. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-06-03 : 12:33:46
|
quote: Originally posted by DOlivastro When I start Query Analyzer, I have to pick a server. When I pick the server, I am immediately connected to a given database, but it is not the one I want. I imagine the default database can be set somewhere, but I can't seem to find it.
If you launch Query Analyser from Enterprise Manager you will not need to login [assuming you have not set EM to "ask" for passwords], and you will be in the appropriate database.There are also some command line parameters for Query Analyser, so if you want to make a short-cut on your desktop it can hook up to a pre-defined database etc.If you can use Windows Authentication then no UserID/Password is required (but you will still get the Default Database for the server you connect to unless you [also] use one of the other methods above)Kristen |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-06-03 : 14:03:18
|
| When I'm switching between databases a lot, I will keep open a QA window with EXEC sp_defaultdb 'login','database'.I can then switch my default easily. This comes in handy if I have to open a lot of source files from Visual Studio, or am testing a batch process. Just an fyi. :)MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-06-04 : 05:36:21
|
Cut&Pasted!Kristen |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-04 : 05:39:45
|
quote: Originally posted by DOlivastro Thanks. Worked like a charm. BTW, answers could be a little more complete. You didn't even mention that this was not done in QA, but in EM.
Hey, you have to learn how to find things... |
 |
|
|
sa
Yak Posting Veteran
77 Posts |
Posted - 2004-06-04 : 12:57:50
|
| hi,if you launch the QA and the default database is not your choicemy suggestion is to put [USE databasename] before your SQL Statements.for example if the default database is DATABASE1 and DATABASE2 is your choice, first typed USE DATABASE2 before your SQL Statements.this will query against DATABASE2 and in DATABASE1. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-06-04 : 13:01:27
|
quote: Originally posted by DOlivastro BTW, answers could be a little more complete. You didn't even mention that this was not done in QA, but in EM.
It is done in QA too. You do it with sp_defaultdb. In fact, more things can be done in QA than in EM.Tara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-06-04 : 13:52:00
|
quote: Originally posted by DOlivastro Thanks. Worked like a charm. BTW, answers could be a little more complete. You didn't even mention that this was not done in QA, but in EM.
The gratitude is overwhelming....Brett8-) |
 |
|
|
stephe40
Posting Yak Master
218 Posts |
Posted - 2004-06-04 : 15:49:46
|
| You can feel the love... :P- Eric |
 |
|
|
|