How to Integrate SQL Server Source Control with SSMS

This article discusses the ways in which developers can integrate SQL source control with SSMS

If you are working as MSSQL DBA or developer for any organization, you might have come across the challenge of integrating the source code with SQL Server Management Studio (SSMS). This article will discuss the solution to the problem in detail.

Add Source Control Plug in to SSMS

Learn How To Integrate SQL Server Source Code With SSMSYou need a good Source Control system for business; one good example is Microsoft Team Foundation Server 2012, and then you can start by using the source control Admin to create a folder. To integrate the source control function to SSMS, please click Tools and then select Options and choose Source control. It will show ‘None’ in Plug-in Selection which indicates that currently SSMS does not have any Source Control Plug-in installed.

You can download various plug-ins from Microsoft depending upon the type of your source code. To install the plug-in, double click the installation file. Follow the on screen instructions by pressing next button. When the installation is completed, press close.

Now you are required to activate the Plug-in you have installed right away, you can do it by clicking on tools and selecting options. Under the Source Control menu, you can select the installed Plug-in, Team Foundation Server MSSCCI Provider.

T-SQL SOURCE FILE

You need to open a T-SQL source file now which you can open through SSMS. You can also open it using Visual Studio shell Integrated Tools for checking in and checking out the Code. To use the latter method, you have to map the folder in Source Control system to some local location during the installation of Visual Studio. Also, one must ensure that all the files being mapped are by default read only.

Now, T-SQL source file can be opened from this folder (Source control) using SSMS but it will obviously show that file is opened in read only mode. Since it is write-protected you won’t be able to save it in SSMS, it will show a warning.

You need to modify the script and check out the source file from Source control. You can easily do it by right clicking on the Plug in and selecting ‘Check Out for Edit’. You can now modify the file since it has been checked out.

Check In Pending Changes

Check In Pending ChangesNow you have to use the ‘Check In Pending Changes’ option to complete Check-In procedure using the Source Control graphic user interface. You can right click the .sql file and select the option of Check in pending Changes and then you have to create a comment in the window that appears. These comments are useful in tracking the changes that you make in the script. If you wish to see the changes in the T-SQL source file, you can click the option ‘View History’ from the source control menu. It will show you all the changes made with proper Time and comment.

We can now conclude some genuine advantages of utilizing a Source Control system for SQL Server. It allows the user to share the code development. Users get options of tracking the entire history of revisions made in a systematic order. It also has the abilities to restore code to specific time point and can also auto-create a backup of your source codes with Source control.

Irrespective of the SQL Server edition you are running in your company, it is vital for you to keep a powerful sql fix tool handy to deal with any incidents of data corruption.

Author Introduction:

Victor Simon is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix mdb and sql recovery software products. For more information visit https://www.datanumen.com/