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

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.
 
M

Michael C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top