0

I am looking for ways of programmatically checking whether SQL Server 2005 or 2008 is installed on a particular machine.

With some MS packages it is as easy as checking Install values in registry on a certain path. For instance to check for Full NET 4 one would need to look at HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full.

Is there a similar thing for SQL Server? I am looking for the real thing, not the "Express". How can I make a distinction? Also, any individual check for 2005, 2008 or R2 or a cumulative check is fine.

Additionally, I am not restricting myself to registry. If the check includes file system search, that is perfectly fine too.

I have found a few answers like this and this but they do not fill my cup entirely.

Community
  • 1
  • 1
wpfwannabe
  • 14,587
  • 16
  • 78
  • 129

1 Answers1

5

The only supported way to figure out the edition is to connect to it and execute

Select ServerProperty('Edition')
Stu
  • 15,675
  • 4
  • 43
  • 74
  • Thanks! I am still looking for a complete solution towards getting the complete list of local SQL Servers. I have tried all code from other posts and none of them provides a complete solution. Usually there is at least a problem with default instance not being enumerated. – wpfwannabe Dec 16 '11 at 09:25