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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Changing Database Focus in Query Analyzer

Author  Topic 

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2010-06-17 : 13:31:52
If I'm coding away in Query Analyzer over one database and I need to quickly point to another, how can I do this? I want to run the same queries on Database #1 but right now my query analyzer is focused on all tables in Database #1

There is a "Change Connection" icon which works but is there a quicker way such as a keyboard shotrcut or something?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-17 : 14:06:36
Databases on the same server?

Two ways:
1. use databasename..tablename instead of tablename
2. type in
use databasename
go
and execute it


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2010-06-18 : 10:19:46
Yea I tried the DatabaseName.TableName but that did not work for some reason. Thanks will try the 2nd.

quote:
Originally posted by webfred

Databases on the same server?

Two ways:
1. use databasename..tablename instead of tablename
2. type in
use databasename
go
and execute it


No, you're never too old to Yak'n'Roll if you're too young to die.


Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-06-18 : 10:30:10
DATABASENAME.OWNER.TableName


select col1 from [mydatabase].dbo.mytable


Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -