Search code examples
sql-server-2012linked-server

how to query linked server


I'd appreciate your help with this issue. I have a linked server pointing to an access database. But, when I want to query something from linked server I notice the following behavior:

  1. Intellisense doesn't recognize linked server name.

http://bit.ly/database_name

  1. There is not a schema name.
  2. Database were automatically named as "default"

http://bit.ly/dafault_name

I could to query with openquery command like this:

select * from openquery([SIM],'select * from 000_Lineas_a_cancelar');

Does that mean I have to use openquery() every time that I want to query to a linked server?

Can't I use a more natural query like this?:

select * from SIM.default.000_Lineas_a_cancelar

Solution

  • Try this or that:

    SELECT * from [SIM]...[000_Lineas_a_cancelar]
    SELECT * from [SIM].[default]..[000_Lineas_a_cancelar]