I'm using C# with SMO and attempting to detect what edition of SQL Server (e.g., enterprise, standard) I'm connecting to. I know how to get the version information, but that only tells me what version of SQL Server (e.g., SQL Server 2008 vs SQL Server 2005).
Does anyone know how to get the actual product edition (e.g., enterprise, standard)?
I need this information because some SQL Server features are only enterprise. Thus, I could just try to call them and catch the exception, but I'd much prefer an upfront detection.
Thanks!
Get-Service is PowerShell cmdlet that lists all the registered Windows services either from a local or a remote server. The output lists the SQL instances of the remote machines. This is because every instance also runs a corresponding service.
SELECT SERVERPROPERTY('productversion'),
SERVERPROPERTY ('productlevel'),
SERVERPROPERTY ('edition')
on my system returns
9.00.1399.06, RTM, Express Edition
It seems this technique only works on SQL Server 2000 or later, if any of your databases are 7.0 or less, you'll have to use @@Version and manipulate the results as others have posted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With