Questions tagged [database-project]
Visual Studio Database Projects allow developers to create, manage, update, and deploy databases with the same development tools and processes as any other source code project.
618
questions
0
votes
0
answers
19
views
SqlPackage Publish stops on error: An insufficient number of arguments were supplied for the procedure or function
I have a Visual Studio Database Project, containing whole database. Build passes without errors, but when I try to deploy the DACPAC to a database, the SqlPackage Publish stops on the following error:
...
0
votes
0
answers
17
views
How to avoid dropping schemas when publishing DB in VS 2019 Database project
When publishing a database from Visual Studio, there are several options to "do not drop" an object if it is not in the Source. However, it seems that there is no option to avoid dropping ...
0
votes
1
answer
45
views
Is there a way to import ANSI_NULLS ON/OFF for stored procedures in VS database projects?
We have around 1000 stored procedures with few having SET ANSI_NULLS ON and some OFF, depending on the scope.
Using VS2019 and importing all procedures into a new project, the ANSI setting is not ...
0
votes
0
answers
37
views
SSDT Unit Test: What exactly does <DataGeneration ClearDatabase="true" /> do?
In a SQL Server Database Project in SSDT (VS2019), I have a Unit Test Project. Inside it is an app.config file which specifies the settings for the Unit Test Database.
One setting is:
<...
0
votes
0
answers
194
views
Database project won't drop table on publish via Visual Studio
I have a database project opened in visual studio 2022. I create a new table and when I execute my publish profile I can see in SSMS it has added the new table.
I now try to delete the table within ...
0
votes
1
answer
76
views
Handling SQL Login/Passwords when deploying a VS Database Project (DACPAC)
After an initial publish to a SQL Server(2019) and after the initial create of my DB project (data tier app) when publishing again it is failing with a drift report. No changes done to the database ...
1
vote
1
answer
51
views
Difference between publish and schema compare
I'm setting up database projects in Visual Studio for our existing databases and I wonder what the difference is between Schema Compare and Publish. For me Publish is a familiar term from using Visual ...
0
votes
0
answers
80
views
Schema compare update only updates one schema
I'm trying to update an old SSDT project so I can deploy it as part of an automated pipeline. It contains three schemas: dbo, cache and legacy.
When I try and update the schema from the DB, it will ...
1
vote
1
answer
864
views
Is it literally impossible to build a SQL Server database project in Azure Data Studio on an M1 Mac?
I'm attempting to set myself up with Azure Data Studio on my new M1 Mac Mini, but the SQL Server database project I'm working on refuses to build. This is the (completely useless) error I'm getting:
...
0
votes
1
answer
108
views
Is Visual Studio necessary for SQL database DevOps CI-CD pipeline?
I am new to DevOps and trying to create CI-CD pipeline for SQL database. In development environment, we use SSMS but when searching the tutorial for CI-CD, everyone is using Visual Studio to create a ...
0
votes
0
answers
64
views
publishing multiple database projects from visual studio
We have a VS solution that has around 11 database projects, when pulling updated from our solution control I want to publish the databases to my local sql server, so that it reflects any changes since ...
0
votes
0
answers
20
views
VS Database Project attempting to create schema after dependent tables
I am using a Database project to manage our database and have a bunch of schemas that are to be added. The problem is that publishing the dacpac has an inconsistent error where it's trying to create ...
0
votes
0
answers
138
views
Visual Studio Database Project SQLCMD Variable Undefined For View Definition
I'm using Visual Studio 2019 to create a database project with two databases that target SQL 2012. For this question I'll call the two databases 'DatabaseOne' and 'DatabaseTwo'. In 'DatabaseTwo', I ...
0
votes
0
answers
52
views
How to change column type while preserving data in .net database project?
I have this table
CREATE TABLE [dbo].[GameDetails]
(
[GameId] INT NOT NULL IDENTITY(1,1),
[Minutes] INT NULL,
CONSTRAINT [PK_GameDetails] PRIMARY KEY CLUSTERED (GameId)
) WITH (...
1
vote
0
answers
197
views
Update To Target Schema Compare Visual Studio Just Hangs
In Visual Studio 2019, when I update the visual studio project form the schema compare tool it just hangs. Its not like its a lot of objects being updated either. I tried googling the issue and most ...
1
vote
1
answer
75
views
Very odd C# sql db decimal issue
So i'm seeing some very odd behaviour that i can't work out what's going wrong and hoping someone can help. Originally i was seeing this in a bigger application with lots of values, but i've stripped ...
-1
votes
1
answer
24
views
Assign diffrent sql scripts for diffrent publish files
I got my database projects and diffrent publish files which targets diffrent databases. Currently i see there could be only one sql marked as PostDeploy which simply means this script will be executed ...
0
votes
1
answer
405
views
Visual Studio 2019 Database Project, How to Refresh/Regenerate
I have Visual studio 2019 database Project which has gone out of sync, because of direct updates on the DB.
How do I refresh my visual Studio 2019 Database Project from Source Database ? Did not any ...
0
votes
1
answer
139
views
Microsoft Database Project - How to change column type and avoid data loss error
I am trying to change the type of a column from VARCHAR to INT.
During the deployment, the database project will stop the deployment due to the "data loss" error:
RAISERROR (N'Rows were ...
1
vote
0
answers
58
views
SSDT Changing Scoped Credentials for different environments
I am looking to use continuous integration to deploy my SSDT project to a UAT and production environments and use external tables which point to azure data lake. The following statements need to be ...
0
votes
1
answer
98
views
SSDT update schema when data exists
I have an SQL server DB project with some table structure, for example:
tblUser
Id
Name
CustomerTypeId
This is the production database and it contains a lot of data.
Next, I need to add a new table
...
2
votes
1
answer
526
views
SQL Server database project gives warning 'Unresolved reference to object sp_executesql'
SQL Server database project gives warning 'Unresolved reference to object sp_executesql' when using sp_executesql inside a stored procedure.
4
votes
0
answers
293
views
VSTS Error: SQLSQL71501: Computed Column: contains an unresolved reference to an object
I get the following error when building out my databaseB in my project. This database is referencing master, msdb as well as the other databases: databaseA and databaseAsynonyms.
databaseB uses ...
0
votes
1
answer
231
views
Getting error while executing DACPAC file (using sqlpackage.exe)
I am getting below error while executing DACPAC file using SQLPackage.
The column [dbo].[Temp].[GMTOffset] on table [dbo].[Temp] must be added, but the column has no default value and does not allow ...
1
vote
1
answer
631
views
How do I create system versioned tables using SSDT in Visual Studio 2019?
I'm trying to create Table with system versioning using Database Project.
Following schema gives error:
SQL70633: System-versioned temporal table must have history table name explicitly provided.
...
1
vote
1
answer
193
views
Nested references between database projects in SSDT cannot be resolved
I'm currently creating a huge database solution with over 40 projects and tons of references.
It's a very common situation that project A references project B, then project B references project C and ...
1
vote
0
answers
200
views
SSDT Post Deployment & Always Encrypted
Struggling with an issue in SSDT when deploying seed data to a table that has AlwaysEncrypted Enabled.
SQL Server 2019 Enterprise
Windows Server 2016 Data Center
Visual Studio 2019 Community Edition ...
0
votes
1
answer
45
views
Does deploying a databse project affect other databases on a database servers?
I have a database for which I created a database project using visual studios.
I have created an Azure Repo and built it using Azure Build Pipelines.
I want to create a release pipeline for the same ...
1
vote
0
answers
45
views
Visual Studio Database Project Ignoring Comments
I am working with Visual Studio 2019. And I am using VS 2019 Database project for generating the "Dacpac" file for db deployment.
My problem is that when I am deploying the .dacpac file ...
0
votes
1
answer
115
views
Execute many scripts only if condition is met, without breaking IF through GO-statement
In my SSDT Project (Visual Studio Database Project) i have a lot of scripts that must be executed only if a condition is met.
The condition is the servername (@@servername != 'LiveServer').
The ...
0
votes
0
answers
282
views
SSDT/Visual Studio Database Project publishing DACPAC referenced DML table trigger SQL71501
I'm unable to publish SQL DML triggers inside of a VS Database/SSDT project. Everything else seems to publish updates/creations fine. However, my triggers aren't ever generated in the script. I can ...
0
votes
2
answers
464
views
Create SSDT objects (stored procedures etc.) only if a condition is met
I am reworking an existing database to work with SSDT for version control and easier deployment after something changed.
For this i need to create stored procedures that only get created when another ...
0
votes
2
answers
69
views
Is it possible to use variables with the 'DIALOG' and 'CONVERSATION' commands?
I've been able to setup my Visual Studio (2019) Database Project up and using database references fine for tables, stored procedures, views, etc. They all seem to match up fine with the schema I've ...
0
votes
4
answers
332
views
SSDT has an unresolved reference to object for views but works fine for procedure
This error is not the "normal error", when there is a missing database reference. I have a database reference added correctly, and it worked fine so far with stored procedures.
The problem:
I have a ...
0
votes
0
answers
688
views
OPTIMIZE_FOR_SEQUENTIAL_KEY breaks VS2019 database project build
I need to set OPTIMIZE_FOR_SEQUENTIAL_KEY = ON for several of my PKs on tables in Azure SQL Databases.
Running the code in SSMS against Azure SQL works perfectly, as expected. But, when I add the ...
0
votes
2
answers
2k
views
Visual Studio 2019 Database Schema Compare ignores foreign key names
This is all related to SQL Server.
Visual Studio 2019 Database Schema Compare ignores foreign key names (definition of the keys is the same) when comparing schema between Database Project (source) ...
3
votes
1
answer
2k
views
Database projects deployment - No file was supplied for reference master.dacpac
I'm setting up database projects for the first time and I'm trying to build/deploy using Azure DevOps. I'm using the MSBuild task hosted in Azure (windows-2019) for the build. I'm using a Command Line ...
0
votes
1
answer
225
views
Performance Issue due to GOTO statement
I'm using SQL Server 2016 database project and my script is like below
DECLARE Marker NVARCHAR(50) = (SELECT Value FROM Table1 WHERE name = 'Marker')
IF( IS NOT NULL)
BEGIN
IF @Marker = 'Marker1'...
0
votes
1
answer
1k
views
Dynamic values to SQLCMD variable: Setvar
I am working with Visual Studio 2017 Database Project (Dacpac) and I have some SQLCMD variables in Publish file (in xml file) like below-
<SqlCmdVariable Include="ClientDBName">
<Value>...
0
votes
1
answer
228
views
Handling partial database in Visual Studio database project
So we have a SQL Server database that is replicated from a 3rd party vendor's cloud down to our local database. Data in the tables is replicated down continuously from their cloud servers and ...
0
votes
1
answer
283
views
SQL Database Project - Deploy script in wrong order
At the moment I have a SQL Project ready to be deployed (Its like-for-like with the prod version).
However, when generating the deployment script - objects such as the stored procedures are coming up ...
3
votes
0
answers
116
views
Visual Studio Database Project References
I’m really confused with how to use database projects in Visual Studio (2019).
I’ve created a new project and imported my database into it. I then can happily edit the SQL and commit it into source ...
1
vote
1
answer
172
views
Visual Studio 2019 database project incorrectly reporting DATA_COMPRESSION option not supported in Azure SQL
Using a create table syntax as follows within a Visual Studio 2019 SQL Server Database Project:
CREATE TABLE [MyTable]
(
-- ...
) WITH (DATA_COMPRESSION = PAGE)
I receive the following build error:...
0
votes
1
answer
616
views
Visual Studio database project ignore error when publishing
I have been trying to deploy my one of database project and I'm receiving few errors like linked server couldn't find etc. But those errors are OK and I want to continue with deployment.
So is there ...
1
vote
1
answer
414
views
Publish database function of visual studio in Rider
I recently moved from visual studio to Rider and I love it. However I've noticed that Rider does not have a function to publish your database project to a server. Does Rider have this option or ...
0
votes
1
answer
769
views
Executing procedure in post deployment script - SSDT
In my post-deployment script file, I'm executing a stored procedure that is originally created within the db project itself:
DB Project:
But whenever I publish the db project I got the following ...
1
vote
1
answer
66
views
SSDT database project as data source for Tabular SSAS project?
Can I use a SSDT database project as a datasource for a Tabular SSAS project?
I am using a visual studio solution to build and maintain multiple projects, sql database projects, ssis packages and I ...
0
votes
0
answers
46
views
SQL Server Database Project allowing unsupported functions for target platform
I have a SQL Server database project which is set to target SQL Server 2008 as its Target Platform.
In one of my stored procedures, I have code as follows:
DECLARE @yearEnd date
SET @yearEnd = ...
2
votes
0
answers
585
views
VS Database Project keeps skipping a table
I have a Visual Studio (2019) Database Project that skips generating a table no matter what I do, and I cannot figure out why.
Background:
I created the project by importing from a SQL database up ...
0
votes
1
answer
1k
views
solution to unresolved references to objects in SSDT database project
I want to build a dacpac of a sql server database . I used ssdt to import the database objects into a project. The build succeeded without any errors but has lots of warnings(more than 100) related to ...