SQL Server Solutions - Determine Programmatically Whether Your SQL Server Is 32-Bit Or 64-Bit (SQL Server 2000)


There may be times when you need to ascertain whether the SQL Server executing your code is a 32-bit or 64-bit installation. Fortunately, this isn't difficult to do. The built-in global variable, @@version, actually returns this information--if you know what you're looking for. For 32-bit installations, the key is to find "Intel X86" in the version information, while for a 64-bit installation, you're looking for "Intel IA-64." The following code snippet (which you could easily adapt into a user-defined function) demonstrates the technique:


  • SELECT AddressSize =
  • CASE
  • WHEN CHARINDEX('Intel X86', @@VERSION) <> 0 THEN '32-bit'
  • WHEN CHARINDEX('Intel IA-64', @@VERSION) <> 0 THEN '64-bit'
  • ELSE 'Unknown'
  • END

Go back