Question: While in Management Studio, I am trying to run a query/do a join between two linked servers.
Is this a correct syntax using linked db servers:

```
select foo.id 
from databaseserver1.db1.table1 foo, 
     databaseserver2.db1.table1 bar 
where foo.name=bar.name

```

Basically, do you just preface the db server name to the db.table ?

Answer: 
```
SELECT * FROM OPENQUERY([SERVER_NAME], 'SELECT * FROM DATABASE_NAME..TABLENAME')

```

This may help you.
I have done to find out the data type in the table at link\_server using openquery and the results were successful.

```
SELECT * FROM OPENQUERY (LINKSERVERNAME, '
SELECT DATA_TYPE, COLUMN_NAME
FROM [DATABASENAME].INFORMATION_SCHEMA.COLUMNS
WHERE 
     TABLE_NAME  =''TABLENAME''
')

```

Its work for me