How to deploy SQL Script in DevOps culture and Rollback situation too? How we can manage database part in DevOps environment/CICD pipeline, Here taking about the SQL Script. For Example any deployment where Insert and Update SQL's, If we setup in CICD pipeline then I will execute everytime thus I will re-execute everytime &amp; DevOps scenarios are fail in this situation.

Overall How we can setup pipeline with SQL script and Application in real world and In case of rollback, How can we manage it ?
There are a few different things you can do:


In your CI process, run your new SQL update scripts against a Dockerized SQL Server. This will allow your CI server to reject the changes if there are basic errors in the script.
If you are fully containerized look into tools like Kubernetes.  These tools have ways to handle rolling back failed production updates.
Utilize a Blue Green Deployment strategy along with integration testing.  This provides a fallback in case things go wrong and allows for different types of automated testing schemes in your CI process.