database-project

Execute SSDT project/dacpac deployment script in single transaction, including pre/post scripts

。_饼干妹妹 提交于 2020-05-09 06:47:05
问题 I am using SQLPackage.exe utility together with Database project's publish profiles to run changes to the SQL Server database. From my understanding, this is the deployment process: Pre-Deployment Script Main Deployment Post-Deployment Script I have "Include transactional scripts" option checked in the publish profile advanced settings, however, that seems to apply to Main Deployment section only. My questions is: If Main deployment fails, is Pre-Deployment script committed? As well as, if

Case sensitivity and database projects

╄→尐↘猪︶ㄣ 提交于 2020-02-20 07:11:12
问题 I created a schema in our SQL Server 2012 database called [Auth] . Then tables and triggers were created as well. Later I was informed that the schema naming standard is lowercase, so it should be [auth] . I renamed the schema in the database project, and all related references. However, the Schema Compare feature doesn't detect the difference, and isn't renaming the schema. This affects our Entity Framework objects, as they should be 'auth' . Is there a way to make the database project see a

Visual Studio 2010 Database Builds Drop If Exists

核能气质少年 提交于 2020-01-24 09:47:07
问题 Is there any way i can change the "Alter" statements for tables and procs to "Drop if exists" when the build spits out the scripts?? Using Visual Studio 2010 Ultimate. TFS 2010. 回答1: I believe the code you are referring to is generated from a template. Look here... C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\Templates\Database Project Items and the modify these two files. New Table Script.sql New Stored Procedure Script.sql 回答2: After the procedure has been created for the

How to ingore a .sql file on build but include it on schema compare

人走茶凉 提交于 2020-01-15 04:04:17
问题 Is there a way to ignore some SQL files in the build of a SQL Server Database Project but include them on the schema compare? I mean, we have some SQL files that cause failures in the build (they point to a linked server which we have no access). What we want is to exclude it from the build (so the build passes) but include it on schema comparisons (so we can see if it was modified). Any suggestions? 回答1: When you deploy use a deployment filter to stop the object being deployed, either write

How to ingore a .sql file on build but include it on schema compare

[亡魂溺海] 提交于 2020-01-15 04:04:09
问题 Is there a way to ignore some SQL files in the build of a SQL Server Database Project but include them on the schema compare? I mean, we have some SQL files that cause failures in the build (they point to a linked server which we have no access). What we want is to exclude it from the build (so the build passes) but include it on schema comparisons (so we can see if it was modified). Any suggestions? 回答1: When you deploy use a deployment filter to stop the object being deployed, either write

Is there a way to make Visual Studio 2010 database projects use DROP and CREATE instead of ALTER for DML

心已入冬 提交于 2020-01-06 19:35:16
问题 When building a deploy script for a Visual Studio 2010 SQL database project, is there any way to instruct the process to use DROP and CREATE for stored procedures and other DML instead of always ALTERing them? As an example, if I change a stored procedure, the deploy script will generate something like this... ALTER PROCEDURE MyProc AS SELECT yadda... I want the deploy script to create something like this instead IF EXISTS MyProc DROP MyProc CREATE PROCEDURE MyProc AS SELECT yadda.... It

Create User in dacpac deployed by SqlPackage.exe leads to login failed SqlException

依然范特西╮ 提交于 2020-01-04 02:06:31
问题 Problem I'm trying to automate SQL deployment including User and Roles. It works when I create the user in Sql Management Studio, but when I deploy dacpack I get SqlException: Login Failed for user 'MyUser' Description I have SQL Server 2016 installed on localhost with both Sql Server and Windows authentication enabled. I have Sql Database project in Visual Studio with these files: MyUser.sql [build action=build] CREATE USER [MyUser] WITH Password='$(MyUserPassword)'; RolesMembership.sql

“Model already has an element” errors (TSD04105) when using Visual Studio 2008 Database Project GDR2

别来无恙 提交于 2020-01-03 17:42:09
问题 I am using Visual Studio 2008 Database Project GDR2 to manage multiple databases and I am getting a number of errors related to synonyms. Project-A has a reference to Project-B because Project-A has a number of synonyms to tables in Project-B. The full error I'm getting is "TSD04105: The model already has an element that has the same name dbo.[OBJECT]". This always points at the synonym. The issue seems to be that the synonym on Project-A has the same name as the table on Project-B. Obviously

VS2010 Database project deploy - “SqlDeployTask” task failed unexpectedly, NullReferenceException

≯℡__Kan透↙ 提交于 2020-01-03 00:51:45
问题 I have a solution in Visual Studio 2010 with a number of SQL Server 2008 database projects. I'm trying to do a 'Deploy Solution' and I'm getting the following error for one of the database pojects: ------ Deploy started: Project: MyDBProj, Configuration: Sandbox Any CPU ------ C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): Error MSB4018: The "SqlDeployTask" task failed unexpectedly. System.NullReferenceException: Object reference

Getting MSBuild and CruiseControl .NET to build and deploy VS2010 database projects

半腔热情 提交于 2020-01-01 09:33:31
问题 I almost have a NAnt script together that will build and deploy VS2010 database projects, but one error stands in my way: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(56,5): error MSB4062: The "SqlBuildTask" task could not be loaded from the assembly Microsoft.Data.Schema.Tasks.Sql, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.Data.Schema.Tasks.Sql, Version=10.0.0