Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Database Project and SQL Azure

I'm really struggling with the best approach for managing a SQL Azure database which is based on a Visual Studio 2010 Database Project. I figured it would be easy enough to use VSDBCMD to create diff scripts for upgrades and then simply run against SQL Azure in SSMS. However, I get the dreaded "The target database schema provider could not be determined. Deployment cannot continue." error.

At this point I'm just assuming either SQL Azure doesn't support something in VSDBCMD or vice versa and I'm looking at other approaches. Here's the approach I'm currently considering:

  1. Script my SQL Azure database from SSMS using the Azure database engine setting.
  2. Create a tempory local database from script in step 1.
  3. Use VSDBCMD to create my delta script against the local database from step 2.
  4. Review/modify the script from step 3.
  5. Run script from step 3/4 against SQL Azure in SSMS.

Good, bad? Any other ideas?

EDIT: I updated to Visual Studio 2010 SP1 today and found that there is a new database schema provider in Microsoft.Data.Schema.Sql.dll: SqlAzureDatabaseSchemaProvider. However, I cannot determine how to actually use this bad boy. Now when I try the same VSDBCMD script against an Azure database, I get:

The source database schema provider Sql100DatabaseSchemaProvider could not be translated to provider SqlAzureDatabaseSchemaProvider. Deployment cannot continue.

I also tried using the Sql90 provider with the same outcome. I even manually edited the dbproj file and changed the DSP property to SqlAzureDatabaseSchemaProvider. When I reload the project I get:

The database schema provider must provide an implementation of DataGenerationServices.

Has anyone tried this with VS 2010 SP1?

like image 435
toddkitta Avatar asked Mar 24 '11 02:03

toddkitta


People also ask

How do I connect Visual Studio to Azure SQL Database?

Open your project in Visual Studio. In Solution Explorer, right-click the Connected Services node, and, from the context menu, select Add Connected Service. In the Connected Services tab, select the + icon for Service Dependencies. In the Add Dependency page, select Azure SQL Database.

Can I create an SQL database with Visual Studio?

You can use Visual Studio to create and update a local database file in SQL Server Express LocalDB. You can also create a database by executing Transact-SQL statements in the SQL Server Object Explorer tool window in Visual Studio.

How do I create a SQL project in Visual Studio?

Launch Visual Studio and select Create a new project. Search for database and select SQL Server Database Project. Click Next. Enter the name of the project.


Video Answer


2 Answers

You can use the SQL Azure Migration Wizard and play with it. Maybe you can get the scripts and edit them as you want. Just an idea.

like image 82
vtortola Avatar answered Oct 12 '22 03:10

vtortola


Check out the properties page of the database project. It should show a dropdown containing the various available providers for the project. If you select the Azure provider you should be able to deploy the project as part of your Azure application.

like image 1
Willem Meints Avatar answered Oct 12 '22 02:10

Willem Meints