locked
Automatically generated scripts for azure databases RRS feed

  • Question

  • Hi Every One,

    I am working in SQL Azure, i want to automatically generated scripts for azure databases with data and schema files also and how to move azure databases azure server to local server. could you please provide steps and any scripts for this scenarios. please help me...........! 


    SrinivasReddyVelpula

    Tuesday, June 14, 2016 6:47 AM

All replies

  • Hello,

    To create a script with the data and schema files of your SQL Azure database, please connect to the database using SQL Server 2012 Management Studio or later version, then make a right click on the database and select “Generate Scripts …”, click Next on the first to screen of the wizard, on the “Set scripting options” page of the wizard click on the Advanced button, scroll down until you find “Types of data to script” and set the option to “Schema and data”, then click OK, click Next 2 times,

    To move an Azure SQL database to an on-premises SQL Server instance use the Export option menu on Azure portal as explained on the following article:

    https://azure.microsoft.com/en-us/documentation/articles/sql-database-export/

    Hope this helps.



    Regards,

    Alberto Morillo
    SQLCoffee.com

    Wednesday, June 15, 2016 3:20 PM
  • Hi Alberto Morillo,

    Thank You For your suggestion but i gone through this way i got the solution before i posted a question here,

    But problem is  i want to make it automatically without any user interface like,

    it just like consider the example,

    you will provide T-SQL or powershell what ever the command you provide i will run those command from windows service that was written in C# code.

    query is: "GENERATING SCRIPT FILES FROM COMMANDS ONLY NOT FROM GUI"

    Please understand my requirement and then help me if u got any idea regarding this or say any way to achive this .............

    Regards

    SrinivasReddy


    SrinivasReddyVelpula

    Friday, June 17, 2016 4:22 AM
  • Hi,

    Have you checked SQL Server PowerShell Extensions (SQLPSX)?


    Best Regards,
    Carlos Sardo

    Tuesday, June 21, 2016 10:57 AM
  • Hi Carlos,

    Yah! just now i was verified this site i did'nt get any solution for my requirement .

    Thanks 

    SrinivasReddy


    SrinivasReddyVelpula

    Tuesday, June 21, 2016 11:36 AM
  • Does this do what you want? Basically SQL Azure support import/export which will export your schema and data to a bacpac file that you can then import. You then just need to call that via powershell

    https://azure.microsoft.com/en-us/documentation/articles/sql-database-export-powershell/

    and corresponding import

    https://azure.microsoft.com/en-us/documentation/articles/sql-database-import-powershell/

    You can also do with SqlPackage.exe.

    Friday, July 1, 2016 8:21 PM