Find out in C # if my instance of SQL Server supports snapshots?

I want to write C # code to create a snapshot , if available . This is supported with SQL Server version 2005, but only in the Enterprise version, but not in Express or Standard edition.

My question is: how do I find out in C # if the connected server supports backing up snapshots (is it Enterprise Edition 2005 or newer or some kind of "hasFeature (...))?

My current solution is trying to catch the following code.

sqlCommand.CommandText = String.Format("CREATE DATABASE {0} ON " +
    (NAME = {1}, FILENAME = \"{2}\" ) AS SNAPSHOT OF {1}",
        databaseBackupName,
        databaseName,
        filenameOfDatabseBackup);
sqlCommand.ExecuteNonQuery();

If I catch SqlException, I assume that there is no support on the connected server.

But there may be other reasons for the failure, although the database supports snapshots (i.e. something is blocked, the connection is broken, ...)

sqlCommand.ExecuteNonQuery(), , .

-, dll, (? sqldmo?), .

- .

+5
1

- :

SELECT  
   SERVERPROPERTY('productversion') as 'Product Version', 
   SERVERPROPERTY('engineedition') as 'Engine Edition'

Product Version ​​: 10.50.1600.1. SQL Server 2005 - 9, , 9., 09. 10., 11., .

Engine Edition INT (1 = /MSDE/Express, 2 = standard, 3 = enterprise/developer).

+5

All Articles