Link to home
Start Free TrialLog in
Avatar of Dovberman
DovbermanFlag for United States of America

asked on

How to specify a select from a different database


I have two databases, Database1 and Database2 on the same server.

I need to select a column form Database1 and a column from Database2

The query is being built in Database1

SELECT

ColumnName FROM Database2.TableName

error:

Invalid object name 'Database2'

What is the correct syntax ?

Thanks,
 
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dovberman

ASKER

Thank you. Works perfectly.