Developer EventsWindows Azure Developer Stories
General ResourcesWindows PhoneWindows Azure
These postings are provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.
If you’ve started reading from this post, you’ll need to go through the previous parts before starting this one: Introduction Part 1: Setting Up a SQL Azure Server and Database
In this part, we’ll take our application’s on-premise database and script it for SQL Azure.
Attach the SQL Server Database
If you haven’t yet downloaded Nerd Dinner, download it from here.
Locate the App_Data directory. You’ll notice there are 4 files. Two .mdf files and two .ldf files. We’re only going to need NerdDinner.mdf and NerdDinner_log.ldf.
You can download SQL Server 2008 Management Studio Express from here if you don’t already have the full SQL Server 2008 Management Studio.
If you’re using SQL Express, the server name will most likely be localhost.
Unfortunately, the name that was originally given to the database is preserved. That’s why the name is so long and doesn’t just display as NerdDinner.
Producing the Script
Save the file in an easily accessible location such as your desktop. You should delete the script file after you deploy it in part 3.
Detach the Database
The on-premise version of the NerdDinner database will no longer be needed. We can now detach it from our SQL Server.
Locate the NerdDinner database.
Remember, it has a long name and is all in capital letters.
That’s all it takes to convert a SQL Server on-premise database to a SQL Azure cloud database! Depending on the complexity of your future applications, you may have to do some more tweaking once the script is created. There are some features of SQL Server that are not supported by SQL Azure, and as such, you’ll have to remove them from the produced script. The database for this walkthrough is intentionally simple, so no further tweaks have to be made.
Next up – executing scripts on the SQL Azure database.
Regarding the use of SQL Server Management Studio, note that SQL Server 2008 R2 is required to have access to the Azure-related features.