Help - Detecting SQL Server, SQL Server Version and Service Pack Level

  • Thread starter Thread starter stanger
  • Start date Start date
S

stanger

Hello,
I've been trying and searching for a way to detect if SQL Server exists on
the computer, and, most importantly, detect SQL Server's version and service
pack level, but no luck to this point. I need it to be C# code.

Would anyone know how to use C# to detect if SQL Server is on the computer
and its version and service pack level?

Thanks in advance.
 
Check the Registry. If you're looking for just the default instance, check
HKLM\Software\Microsoft\MSSQLServer\CurrentVersion and look at the
CSDVersion value for the Service Pack Level (8.00.760 is SP3, 8.00.761 is
SP3a for instance). Use Microsoft.Win32 namespace and RegistryKey to read
Registry.LocalMachine to get this info.

Thanks,
Michael C., MCDBA
 
Back
Top