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. Gameroff Avatar
    Gameroff

    Thanks,

    man, you save me… thank a lot.-

    🙂

    1. Adisan Patel Avatar
      Adisan Patel

      Thanks for Perfect solution

  2. Anonymous Avatar
    Anonymous

    Thank you! This solved my problem completely!

  3. Steve F Avatar
    Steve F

    This tip was helpful especially with having the linked server to work with a Excel spreadsheet through a ODBC DSN (MSDASQL).

    Thanks!

  4. Angel Paz Avatar
    Angel Paz

    Tnanks a lot.. you really help me with my problem.. !!

  5. eric Avatar
    eric

    for others also researching this issue. you will come across an alternative notation like this: select * from LINKEDSERVER.DSNNAME..TABLENAME.

    this seemed to work, but wound up throwing an access denied error from my remote server. not sure why as i can use the dsn from within a dts package without incident. i was not able to diagnose that and turned on the level zero switch and it works now. thank you!!

  6. Daniel Avatar
    Daniel

    Thanks. It works in our shop.

  7. Steve Avatar
    Steve

    Thanks for the tip. This saved me a lot of time.

  8. John Avatar

    Worked for me. Thanks for the tip. But I wonder.

    I could change “level zero” back to 0 (off) and it would still work while on the server. Could it just be initializing MSDASQL on the server?

    Testing from my PC, it didn’t work set to 0 from the client, but changing “level zero” again back to 1 fixed that problem as well.

  9. Sunshine Lewis Avatar

    I’m not sure John. I have very little actual understanding of the problem despite trying to decipher books online.

  10. Milad Qamari Avatar
    Milad Qamari

    Thank you guys . It works great.

  11. HadAProblem Avatar
    HadAProblem

    Thanks a lot. I was looking for this.

  12. IS Support Avatar
    IS Support

    The Google Gods are smiling on you. Thank You very much. The feature also works
    on ProvideX databases. We thank you.

  13. Christopher Rannow Avatar
    Christopher Rannow

    Thank you for your post. It saved me a lot of time.

  14. Marcus Avatar
    Marcus

    Kudos man, i was pulling my hair out.

  15. Joe Avatar
    Joe

    Thanks!

  16. FoS Avatar
    FoS

    Thanks I’ve spent 3 days looking and this was the only reference I’ve found period.

    Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks.

  17. geopelia Avatar
    geopelia

    You saved my ass! Thank you!

  18. gentoose Avatar
    gentoose

    A good two years after posting, this tip still saves lives!

    By the way, this post is still valid on SQL Server 2008.

    Thanks!

  19. Artem Repko Avatar

    Thank you. It works.

  20. Ravi Singhal Avatar
    Ravi Singhal

    Thanks a lot man….google god really smiled upon you…it was first search result and it worked perfectly.

  21. [HP-5285] MOODLE: Senkron Çal??m?yor…

    [Sparkalyn.com|http://www.sparkalyn.com/2008/12/invalid-schema-error/] blog’undan bulunan çözüm {quote} Here’s the alternative. Go to the provider options screenIn SQL Server you can see the list of providers in a folder above the linked ……

  22. Amal Graafstra Avatar

    The google gods have smiled on you, and me too. This saved me down time!

  23. David Avatar
    David

    OH MY GOSh!!!

    I wish I had typed in the error message 4 hours ago.

    Thank you so much for the fix. You are my hero today.

  24. Emma Sharp Avatar
    Emma Sharp

    Thanks a lot mate you make my day. You are a star *

  25. Igor Avatar
    Igor

    Thanks a lot.

  26. robhob Avatar
    robhob

    You’re the man!

    This site should be listed as a protected species and never allowed to be taken down.

    Thanks for the info!

  27. Kha Avatar
    Kha

    Don’t know why this fixes it but thank you! If anyone finds out why this fixes the issues please enlighten us all.

  28. it-guy Avatar
    it-guy

    This saved my live. Cant thank you enough !

  29. Robert D Avatar
    Robert D

    Whatever it does, it did the trick for me! Thanks.

  30. Jimmy H Avatar
    Jimmy H

    Save my bacon! configuring bunch linked servers on SQL2012 and this fixed em ALL!!!

  31. Tanja Avatar
    Tanja

    Thanks. Solved my problem on the spot.

  32. Brian Arsuaga Avatar
    Brian Arsuaga

    After googling ALL DAY I finally found this solution. Thank you, these next lines are to elevate visibility. For sql server 2008 to use a mysql linked server without openquery, an openquery alternative is to enable Level Zero Only on the provider properties.

  33. Turner Avatar
    Turner

    Much appreciated. Got to love it when someones already done the leg work for you.

  34. BenCabrera Avatar
    BenCabrera

    This works just fine, for further explanation the “Level Zero Only” restricts access to the linked server DB especified on creation.
    You can’t switch to others DB’s on the Linked Server.

    The sintax LinkedServer…TableName will work, the LinkedServer.DataBase..TableName sintax wil throw error.

    1. Nivas Avatar
      Nivas

      Thank you for the help. It saved me a lot of time.

  35. HP Avatar
    HP

    Darn man, you are my superhero!!!!!

  36. DB_newbi Avatar

    Great post, this resolved the issue. Appreciate the hard work and sharing the info with the rest of the world, Thank You!

  37. Craig Avatar
    Craig

    Yes, amazed I was found this, such a simple but VERY Obscure solution. Thank you for posting this.

  38. Matt Avatar
    Matt

    I wasted so much time trying to figure this out in SQL 2016 before I came across this. Thanks!

  39. Ann Smith Avatar

    @SerfCompany

  40. itkrondotcom Avatar

    IT Kron offers our clients end-to-end solutions that help their businesses to achieve specific and measurable results.http://itkron.com/

  41. Anon Avatar
    Anon

    OMG! THANK YOU, THANK YOU, THANK YOU, THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    I’ve been pulling my hair out over this issue.

  42. Elvin Avatar

    Quick weight loss always results in weight quick gain as body never adapted to the changes, so it’ll rebound back.

  43. baz g Avatar
    baz g

    Honestly it’s very rare that I find answers to my questions outside the boundaries of SO. This is that rare occasion. Thank you.

  44. Radek Avatar
    Radek

    Thank you. Since i had another error with OLEDB provider it was only option to setup linked server with ms access db. You helped a lot!

  45. Mark Weir Avatar
    Mark Weir

    Life Saver on the ‘zero only’ for the provider

    Thanks

  46. Adrian Avatar

    after a few hours of googling I found your post that saves me. Now I can passs parameters to my query instead of using open query.

    thank you!

  47. themoonatomicc.tumblr.com Avatar

    There is certainly a lot to know about this issue.

    I really like all the points you’ve made.

  48. Angela Avatar
    Angela

    Thank you. A great help.

  49. Brian Avatar
    Brian

    Thank you very much ! Appreciate it ! Great help !

  50. Alexandre Avatar
    Alexandre

    Thanks!!

Leave a Reply

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