Windows Azure SQL Database Partition and Federation Code Examples

By default, Windows Azure SQL Database supports up to 150 databases in each SQL Database server, including the master database. You can create up to 149 databases in each SQL Database server. An extension of this limit may be available for your SQL Database server. For more information, contact a customer support representative at the Microsoft Online Services Customer Portal. More info on General Guidelines and Limitations (Windows Azure SQL Database).

There are two options to workaround the size limit of Windows Azure SQL Databases: Partition and Federation.

You can divide tables across multiple databases using vertical, horizontal or hybrid of partitions. The following two posts discuss SQL database partitions in great details. You can also download and test the code sample from MSDN.

Federations in SQL Database are a way to achieve greater scalability and performance from the database tier of your application through horizontal partitioning. One or more tables within a database are split by row and portioned across multiple databases (Federation members). This type of horizontal partitioning is often referred to as ‘sharding’. The primary scenarios in which this is useful are where you need to achieve scale, performance, or to manage capacity. More info on SQL Federation here.

You can download and test one code sample from MSDN below.