SQL SERVER – Generate Database Script for SQL Azure

When talking about SQL Azure the common complaint I hear is that the script generated from stand-along SQL Server database is not compatible with SQL Azure. This was true for some time for sure, but not any more. If you have SQL Server 2008 R2 installed you can follow the guideline below to generate a script which is compatible with SQL Azure.

SQL SERVER - Generate Database Script for SQL Azure azurescript1

SQL SERVER - Generate Database Script for SQL Azure azurescript2

SQL SERVER - Generate Database Script for SQL Azure azurescript3

SQL SERVER - Generate Database Script for SQL Azure azurescript4

As above images are very clear I will not write more about them. SQL Azure does not support filegroups. Let us generate script for any table created on PRIMARY filegroup for stand-alone SQL Server and compare it with the script generated for SQL Azure.

SQL SERVER - Generate Database Script for SQL Azure azurescript5

You can clearly see that there is no filegroup in the code generated for SQL Azure. Give it a try and please your comment here about what do you think about the same.

Azure services are made up of networks, drives, servers, etc. all hosted by Microsoft to provide scalable, on-demand services. This architecture comes with many positive attributes, but there are trade-offs when compared to an on premise solution.

Azure has an advantage in cost, deployment time, reduction in administrative and management overhead and Azure can be used to easily scale up or down depending on the needed workload. However, as stated, the underlying infrastructure is hosted. As an administrator, you do not have the same level of control over the individual components and there is less opportunity for deeper performance tuning operations as there are four on premise servers. Azure hardware is commodity hardware meant for scaling out and handling many applications.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Azure, SQL Scripts, SQL Server
Previous Post
SQLAuthority News – Training and Consultancy and Travel – Story of Last 30 Days
Next Post
SQL SERVER – Subquery or Join – Various Options – SQL Server Engine knows the Best

Related Posts

10 Comments. Leave new

  • What is this SQL Azure? I tried to google it and read it.But could not understood properly.

  • Satish Naphade
    June 10, 2010 12:56 pm

    Hi Pinal,

    i follow your articles it’s very nice.

    do you have any article on Transaction isolation levels which
    will give me a brief explanation about isolation with example.


    thanks in Advance

  • Md Nasir Uddin
    June 14, 2010 12:00 pm

    I have installed sql server 2008 R2 Express Edition. but I could not find “Script for SQL Azure Database” option. How can I do this?

  • How can I generate the script via a command line? (this solution uses the GUI interface) thx in advance..
    – bt

  • Rajarshi Poddar
    March 31, 2011 4:39 pm


    Can you tell me how to do this using cmd prompt?

  • Hi

    It seems like azure is a trim down version of sql servers Can any one tell about because encryption and other basic restricting features are not supported in azure.

  • Is this supposed to work for a “change” script, as opposed to scripting the entire DB? I’m trying to do a change script, and have changed my scripting options setting, but it’s not respecting what I changed it to. Seems like it may only work for scripting an entire DB. Anyone know how to get this working? Thanks.

  • Can I generate database script, with “sql script”, if I want to save database changes

  • Vicente Zambrano
    October 2, 2015 3:00 am

    Perfect, It work for me in a DB of 20MB

  • Jorge Barquero
    May 14, 2016 11:26 pm

    Thanks you very much, it worked very well


Leave a Reply