Continous Integration Within SQL Server

MrFlinstone 686 Reputation points
2021-03-09T11:28:59.5+00:00

Hi All.

I would like to know scenarios or use cases for SQL server and continuous integration tools. Is it such that when changes are made to database objects a CI took kicks in. With applications, what I have read is that when an application is developed, it goes through a build process and a continuous integration tool can do this especially when working within a team of multiple developers who could also be changing the code. I am curious as to how this works within a database only setup, and also within a setup where you have scripts and non script based applications.

Thanks in advance.

SQL Server Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Nandan Hegde 36,146 Reputation points MVP Volunteer Moderator
    2021-03-09T11:45:28.817+00:00

    Hey @MrFlinstone ,
    Assuming you have a SQL server :

    Create a visual studio database project and checkin all your database scripts in that projects.

    Then using Azure Devops:

    1. Create a build Pipeline that would build and validate your database project to generate a DACPAC
    2. Create a release pipeline to publish the DACPAC to the database server.

    The Build pipeline can be linked to your database project in either Github or GIt or VSTS and whenever anyone makes changes to the database projects, the build and release pipelines would be triggered and your changes would be deployed

    You can refer the below link:
    https://medium.com/multinetinventiv/automate-build-and-deployment-of-azure-sql-database-using-azure-devops-with-azure-pipelines-9cf9b576b5c1

    which would be somewhat similar for SQL server


  2. Vaibhav Chaudhari 38,916 Reputation points Volunteer Moderator
    2021-03-09T11:59:33.427+00:00

    You already have mentioned the use case of it.

    Developers work on the DB changes like creating new tables, updating existing SPs etc. Once dev and testing is completed, the SQL scripts are checked in to the code repository and the CI (I have used Azure DevOps tool) process triggers the build which builds the database project and ensure all scripts are fine, no any syntax error or no inconsistency.

    For reference -
    https://www.sqlshack.com/continuous-integration-sql-server-data-tools-visual-studio-2017/
    https://www.mssqltips.com/sqlservertip/5164/basic-database-continuous-integration-and-delivery-cicd-using-visual-studio-team-services-vsts/


    Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.