SMO 'Microsoft.SQLServer.BatchParser Error SQL Express 2008 32 bit running on Windows Server 2003 64 bit RRS feed

  • Question

  • I have an app that uses SQL Server 2008 Express and I wrote a simple manager app to help manage my database easily for customers.

    The database manager uses SMO to perform simple tasks like create a new database, change a login password and perform simple backups and restores.

    When running on a 32 bit server everything connects fine, but when I install on a 64 bit server I get the following exception when attempting to create a login and get a similar exception when attempting to run a script in an empty database.

    "ExecuteNonQuery failed for Database 'master'.
    "Cound not load file or assembly 'Microsoft.SQLServer.BatchParser, Version=, Culture=nuetral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified."

    I have reinstalled .NET Framework 3.5 SP1, SQL Express 2008 and the SMO Collection from the 2008 Feature Pack but still no joy.

    The server does have SQL Server 2005 installed as well and my database manager produces the same exception when attempting the scripts against that server.

    All works fine on a 32 bit machine.
    • Moved by Barclay Hill Friday, March 6, 2009 12:05 AM Better forum for question (Moved from Visual Studio Team System - Database Edition to SQL Server SMO/DMO)
    Tuesday, March 3, 2009 7:05 PM

All replies

  •  Sounds like you need to install the 32 bit versions of SMO. There are links to the 32 bit version of SMO in this blog posting.

    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition)
    • Marked as answer by DevChris Tuesday, March 3, 2009 10:12 PM
    • Unmarked as answer by DevChris Tuesday, March 3, 2009 10:12 PM
    • Marked as answer by Don Tan Wednesday, November 11, 2009 4:30 PM
    • Unmarked as answer by Don Tan Wednesday, November 11, 2009 4:30 PM
    Tuesday, March 3, 2009 7:14 PM
  • This did not resolve the issue. I do have the 32bit SQL Server Management Objects installed.

    Microsoft.SQLServer.BatchParser x86 exists in \Windows\assembly folder. The x86 version is also present as is Microsoft.SQLServer.BatchParserClient MSIL.

    Doesn't make sense to me.

    I can say one thing, I cannot reference Microsoft.SQLServer.BatchParser in my visual studio project. It simply doesn't show in the list of available .net libraries. Is that usual?

    Tuesday, March 3, 2009 9:04 PM
  • Is there anything else that needs to be present or installed besides what is mentioned? I already had those installed and have doubled checked them by uninstalling and reinstalling them.

    I recompiled my app as a 64 bit app and ran it against the 32 bit SQL Servers (both 2005 and 2008) and the same error is still generated.

    My code is able to create a database, but it cannot run ExecuteNonQuery function.
    Wednesday, March 4, 2009 8:45 PM
  • This still doesn't work and there is clearly something else that needs to be present other than what is mentioned in the blog.

    Anyone have a complete list of all libraries which need to be installed to run SQL Server 32 bit on 64 bit Windows so that SMO works?

    Thursday, March 5, 2009 8:27 PM


    I asked  the SMO redist related  person about the issue .

    Installed SMO redists and did some digging on my 64bit machine with Windows2008 found that MS.BatchParser.dll(x86) has dependency errors on gpsvc.dll and linkinfo.dll of x86 flavours. Unfortunately, these files aren’t installed  under SysWOW64 which is why the dependency errors. There isn’t whole lot of information on this online although there some errors. However, both these files are installed as SxS binaries in fusion folders under %windir%\winsxs on my machine. Copying these files over is certainly helping the “files not found” error to go away, not sure what is it’s impact on functionality.


    Before we conclude one way or the other, I would ask the customer for more information to see what exactly are missing dependencies in his case – one way to get this information is by using dependency walker tool  on Batchparser.dll  



    Can you try the workaround he is suggesting and report your findings.
    Please answer his questions regarding dependencies

    and log a bug at http://connect.microsoft.com/SQLServer/feedback/

    Alok Parmesh

    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
    Monday, March 9, 2009 7:14 AM
  • Thank you for the response. The email ended up in my spam folder and I just saw it.

    I'll check the dependency walker first and see what it tells me and post what I find. Might be a day or two as I'm handling something else at the moment.


    Thursday, March 12, 2009 10:45 PM