Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSDT, do I need different dacpacs if I need to deploy the same db to SQL Server 2008 and 2012?

While converting database project to SSDT and upgrading to SQL Server 2012 I need deployment script to work for both SQL Server 2008 and 2012.

I am using sqlpackage.exe /Action:Publish to deploy the latest database bits.

In sqlproj project properties I do see a target platform dropdown with options 2005/2008/2012 sql server. Does it generate a different dacpac if I change this target platform? Do I need to carry two versions of dacpac for each sql server version?

Or will the same dacpac work for any version of sql server?

like image 458
Paul Avatar asked May 23 '12 17:05

Paul


2 Answers

I know this is 11 months old, but there is an option when you come to deployment specifically for this scenario - AllowIncompatiblePlatform.

//Set Deployment Options
DacDeployOptions dacOptions = new DacDeployOptions();
dacOptions.AllowIncompatiblePlatform = true;

Without setting the option I can deploy a 2008 dac to sql2012, but it will error if I deploy a 2012 dac to sql2008 with:

Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentCompatibilityException: 
A project which specifies SQL Server 2012 as the target platform cannot be published to SQL Server 2008.

Setting the option means I do not get this error and can deploy to previous versions (back to 2005 I believe). NB You may also need to set the option TreatVerificationErrorsAsWarnings to true - YMMV.

like image 143
Fetchez la vache Avatar answered Nov 15 '22 02:11

Fetchez la vache


The short answer is yes - different DACPACs for different SQL Server editions. Bob Beuachemin wrote a useful blog post about DAC Fx3.0 vs. DAC 2.0

like image 40
Lynn Langit Avatar answered Nov 15 '22 03:11

Lynn Langit