Thursday, February 17, 2011

How can you detect on runtime if your sql-server 2005 instance is a 32 or 64 bit instance?

How can you detect if your sql-server 2005 instance is a 32 or 64 bit instance from C# code? If you know some documentation on this issue, please let me know.. Thanks!

From stackoverflow
  • I'm curious... why?

    E. : Optimizations fine tuning..
  • Use SERVERPROPERTY ( propertyname )

    With property name Edition.

    64-bit versions of the Database Engine append (64-bit) to the version.

    SELECT SERVERPROPERTY ( 'Edition' )
    

    For me on my x64 machine returns the following string value: Enterprise Edition (64-bit)

    You could also check the env variable PROCESSOR_ARCHITECTURE to see what the machine itself is running as.

    E. : Is this listed also on the registry or can be concluded from a file version? I need a way to do this not assuming I have a valid connection.
    Brian R. Bondy : updated answer with PROCESSOR_ARCHITECTURE note. I'm not 100% sure if you can install an x86 SQL on an x64 though. But I don't think you can.

0 comments:

Post a Comment