Hi
One option is dynamic sql.
declare @dbanme sysname
set @dbname='db'
exec('select * from '+@dbname+'..tblname)
--in the case that the structure of the dbs are the same
or create a vew in master database like
create view myview
as
select 'db1' as dbname, * from
db1..tbl
union all
select 'db2 as dbname, * from
db1..tbl
......
usage
select * from view where dbname='db1'
"K Viltersten" wrote in message
>I know i can switch the currently refered
> database by choosing a different name in
> the drop-down menu. However, i'd like to
> programmatically pick a database.
>
> I'd like to compare the same search from
> two databases as follows.
>
> select * from olds.stuff
> select * from news.stuff
>
> How can i do that?
>
> --
>
>
> Regards
> Konrad Viltersten
> ----------------------------------------
> May all spammers die an agonizing death;
> have no burial places; their souls be
> chased by demons in Gehenna from one room
> to another for all eternity and beyond.
> >> Stay informed about: Refering to multiple databases