Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select via database name alias?

Status
Not open for further replies.

hbaake

Programmer
Jun 25, 2001
19
NL
Is there a way in SQLServer2000 to select data via a database name Alias?

I would like to join two tables on different databases (or even different servers), but I don't want to change all the server.databasename.owner table prefixes everytime the script is run on a different server...

So, can 'SELECT server1.databasename1.owner1.table1.col1 ...' be changed into 'SELECT dbalias1.table1.col1 ...' ?

Thanks for your help,
Hugo.
 
select VeryLonaName x from xxx where
x=somevalue

or
select t.a x, t.b y from (select xxx a, yyy b from zzz) t
where
x=somevalue or y=theotherone John Fill
1c.bmp


ivfmd@mail.md
 
Hi Hugo,
For these special cases i use dynamic sqls in my scripts.
take a look at thread
thread183-108556
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top