We have an existing SQL database on a SQL Server. We use Azure repos. I would like to be able to create a repo for the SQL database. Not sure what the proper steps are. I can create an empty repo in azure devops and clone it to my local machine. I can open up Visual Studio, how do I import the SQL database into a new project? Once I have the SQL project I can push back up to azure devops with sync...push and create pull request.
1 Answers
I would like to be able to create a repo for the SQL database. . I can
open up Visual Studio, how do I import the SQL database into a new
project? Once I have the SQL project I can push back up to azure
DevOps with sync…push and create a pull request.
There are multiple ways you can import your SQL database project into Azure Repos Refer to below:-
I created a Database object and imported it in an SQL Server project in VS code like below:-
There are 3 ways you can import this SQL project from your local machine to Azure DevOps:-
Approach 1)
When you create a new project in Azure DevOps a default repo with the same project name is created in the Azure DevOps organization. you can use the built-in authentication to import your repo in Azure DevOps, refer to below:-
I ran these commands in my VS studio code command line to import the SQL project to the Azure DevOps repo like below:-
git --version
git init
git add .
git commit -m "Initial commit"
Now copy the remote origin code from the Azure DevOps page above Refer above Image - Push an existing repository from the command line and push it to our Azure repos by logging into the Azure DevOps account like below:-
git remote add origin https://<org-name>@dev.azure.com/org/project-name/_git/project-name
git push -u origin --all
SQL project added to Azure DevOps repos like below:-
Now you can set up a build and run the SQL pipeline or even commit changes to your project and push it via git push in the same repo.
Approach 2)
Importing via GitHub.
You can save this entire SQL project in your GitHub account and import it to Azure DevOps like below:-
You can directly paste the Github repo URL and import it directly without any Authentication for the Public repository or Import it with Git authentication with PAT Token like below:-
Click Require authentication > Enter the Username and Password of your GitHub account and get the PAT from GitHub Account Settings > Developer settings > Personal access token > Generate new Token
Github repo got imported in Azure DevOps successfully.
Approach 3)
Import the Project from VS studio code like below:-
You can Push the code from Visual Studio to Azure DevOps Repo with the above option.
You can start creating a release pipeline and import the SQL project as an Artifact and run the pipeline like below:-

- 3,668
- 1
- 2
- 11