Sql-server – 32-bit DLL on SQL Server 2008 x64

32bit-64bitsql server

Is it possible to run a 32-bit DLL on a SQL Server 2008 x64 server?
I need to use the DLL inside a stored procedure.

Thanks

Best Answer

A 64 bit SQL Server can only call 64 bit DLLs.

Here is a quick enumeration of some possible solutions, each with their own warts/flaws, in no particular order:

  1. You could try this, but I can't vouch for it. It seems like a hack, and I wouldn't try it unless I was desperate.
  2. Talk to the vendor and see if there is a 64 bit version of the DLL. (Just in case: You (probably) need a 64 bit x86 version. A 64 bit Itanium version will not do.)
  3. Recompile the DLL as a 64 bit DLL.
  4. Rewrite the DLL using straight Transact SQL. (I've done this, as part of a retrofit/modernization project, but only with some extremely simplistic DLLs that probably didn't need to be extended procedures in the first place.)
  5. Rewrite the DLL using .Net and the SQLCLR. (This is the best thing to do, long-term. IMO.)
  6. Find a 32 bit server, install the DLL there and call it from the 64 bit server via a Linked Server.
  7. Find a way to use the DLL via XP_COMMANDSHELL or a job step, or run it through some other mechanism.

This is a common problem with legacy stuff. For example, (until recently) there were only 32 bit versions of the Fox Pro ODBC drivers, which are just DLLs.