An invalid schema or catalog was specified for the provider “MSDASQL” for linked server

Make sure “level zero only” is checked on the MSDASQL provider.

Now to the question!

SQL Server’s linked server feature lets you link to a remote server through an ODBC connection. Once the server is linked, you are supposed to be able to reference it using four-part notation like so:

SELECT * FROM linkedserver...tablename

If you’re like me that query will give you an error message instead of a result set. So you will Google the error and be told by forum posts the world over that the openquery function is your only hope.

Now openquery is a great little piece of work but it doesn’t contribute much to code-readability. But since it’s your only hope, you’ll try to clean things up by creating elaborate views that mimic the tables in the linked server and then using those views in other views until the whole mess is so complicated that all of your queries timeout and you spend most of your database time watching a progress bar and wondering why life hates you.

Here’s the alternative.

  1. Go to the provider options screenIn SQL Server 2005 you can see the list of providers in a folder above the linked server (assuming you have appropriate permissions). Right click on MSDASQL and go to properties. In SQL Server 2000, the provider options button is in the dialog box where you create the linked server.
  2. Check the box that says “level zero only”

I don’t know what this means (even after reading the definition). I think it means that the SQL Server won’t do any optimization of the result set (it will be the responsibility of the linked server) but that’s just a guess.

I do know that after checking that box, my four part query worked. It took me about three days of searching to find that answer at the bottom of a thread somewhere so I’m posting it here in hopes that the Google gods will smile upon it.

Also thank you Alexandre Léveillé.

Comments

59 responses to “An invalid schema or catalog was specified for the provider “MSDASQL” for linked server”

  1. theMark Avatar
    theMark

    Still Useful! Thanks!

  2. Ashish Naidu Avatar
    Ashish Naidu

    Hi,

    I’ve tried checking the box for “level zero only”; it still doesn’t work for me. I get the same “four-part name was supplied” error. I’ve created a linked server to Snowflake on my SQL Server 2014.

    Any more ideas?

    1. Ed M Avatar
      Ed M

      you should change it from:
      select * from [linkedserver]..database1.table1 will return error
      to:
      select * from [linkedserver]…table1 run ok!

  3. Ed M Avatar
    Ed M

    Thanks! Solved my challenge!

  4. […] which points to it, and I can successfully query most tables, both via OPENQUERY and 4-part naming (after setting LevelZeroOnly for the MSADASQL provider). One table consistently throws out an […]

  5. Bala Avatar
    Bala

    Thank you! Your suggestion saved lot of time!

  6. Leon Janzen Avatar
    Leon Janzen

    This is still relevant on SQL Server 2016.
    Thanks for the helpful solution!

Leave a Reply to #StackBounty: #sql-server #linked-server #sqlite Column length error querying SQLite via SQL Server Linked Server – TechUtils.in Cancel reply

Your email address will not be published. Required fields are marked *