0

I am new to Devops. I want to Execute/Deploy SQL script to sql server through Devops(CI-CD). I would like to know what are the possible options to achieve this and which is the preferable one Security wise and performance wise ???

My SQLscript will mostly contains 4, 5 Insert/update Script or 1 Procedure or function.

priyanka gharat
  • 25
  • 1
  • 2
  • 10
  • Does this answer your question? [how to execute sql script using azure devops pipeline](https://stackoverflow.com/questions/65885558/how-to-execute-sql-script-using-azure-devops-pipeline) – Shamrai Aleksander Feb 03 '21 at 10:53
  • 1
    No. it is taking about sql scripts. we need to go for DACPAC – Venkataraman R Feb 03 '21 at 10:56
  • @priyankagharat, updated my answer. please refer to that – Venkataraman R Feb 08 '21 at 11:24
  • Thank you @VenkataramanR for reply..... I have .PS1 file which contains Insert scripts and Rest stuff to deploy other things(other than SQL) Is it possible to read those specific SQL scripts(mentioned below) from .PS1 using "inlinescript". How???(what will be inlinescript?) Could you please help me in this And when to prefer DACPAC Script,sqlscript or Inlinescript... Example: <# DEV Script 1 INSERT INTO Table1(.......) VALUES (.........) Script 2 INSERT INTO Table1(.......) VALUES (.........) Script 3 INSERT INTO Table1(.......) VALUES (.........) #> – priyanka gharat Feb 08 '21 at 13:16
  • these insert scripts will be part of pre-deployment script. no need to have this as separate .ps1 file. Also, I would suggest you to raise separate question on this. Adding more information to same question and updating answer, will lead to confusion for future readers of this question – Venkataraman R Feb 08 '21 at 13:59

1 Answers1

2

Generally, it is best practice to deploy the SQL server database code as DACPAC in DevOps in CI/CD manner.

Read more Azure pipelines for SQL deployment

You can refer to the blog posts, which provide step by step for the same:

Venkataraman R
  • 12,181
  • 2
  • 31
  • 58