Checking Your SQL Azure Server Connection

This entry has been cross-posted from the Windows Azure Team Blog .

As the SQL Azure July 2011 Service Release is being rolled out, we want to advise you of an important consideration for your application logic. Some customers may be programmatically checking to determine if their application is connected to SQL Azure or another edition of SQL Server. Please be advised, you should not base your application logic on the server version number, since it changes across upgrades and service releases. It is okay, however, to use the version number for logging purposes.

If you want to check to see if you’re connected to SQL Azure, use the following SQL statement:

SELECT SERVERPROPERTY('EngineEdition') == 5.

See the SQL Server Books Online for a full description of the SERVERPROPERTY function.

The current SQL Azure service release will upgrade the underlying SQL Azure database engine version from 10 to version 11 as it is rolled out across data centers.

You will see this server version number change show up in server-side APIs such as:

• SERVERPROPERTY('ProductVersion')

• @@VERSION

and also client-side APIs such as:

• ODBC: SQLGetInfo (SQL_DBMS_VER)

• SqlClient: SqlConnection.ServerVersion

There will be a period of time during the service upgrade, measured in days, during which some user sessions will connect to version 10.25.bbbb.bb SQL servers and other user sessions will connect to version 11.0.bbbb.bb SQL servers (bbbb.bb is the build #). One given user connection to one database may see different server version numbers reported at different times. At the end of the upgrade all sessions will be connecting to version 11.0.bbbb.bb SQL Servers.

User queries and applications should continue to function normally and should not be adversely affected by the upgrade.

The July 2011 Service Release is foundational, with significant upgrades to the underlying engine that are designed to increase overall performance and scalability. This upgrade also represents a big first step towards providing a common base and feature set between the cloud SQL Azure service and our upcoming release of SQL Server Code Name “Denali”. Please read the blog post, “Announcing: SQL Azure July 2011 Service Release” for more information.