Link to home
Start Free TrialLog in
Avatar of RIAS
RIASFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Integrate GIT with SQL Server Stored Procedures and Views.

Hello Experts,
Is there anyway I can integrate git ( local repository ) with Stored Procedures and Views.

Thanks

Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

No need to do anything special.

We just make a folder named SQL Script or DB Scripts and whenever we change an SP or a View we copy over definition. This cannot get any simpler than that.
Avatar of RIAS

ASKER

Thanks Chinmay,
But, how you get the version history?

Basically you have to maintain them yourself. For example, Dev1 made a change to the SP, S/he must check it in. Next time Dev2 made a change then the changes must be checked in, similar to any file that you put in GIT, version history will be maintained by GIT just like any other file.
Avatar of RIAS

ASKER

The requirement Chinmay , is to get all SP's and views in the GIT. 
Avatar of RIAS

ASKER

Ahh , perfect!

ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RIAS

ASKER

But, for that I need to get all SP from SSMS  to a folder isn't it?  
Avatar of RIAS

ASKER

Thanks Chinmay, our comments were having a bit of lag in posting. 
Avatar of RIAS

ASKER

Just out of curiosity, is there a way to connect SSMS to git  local repository) ? 
But, for that I need to get all SP from SSMS  to a folder isn't it?  
Yes. SSMS can do that for you easily. You may use SSDT from within Visual Studio as well.
Avatar of RIAS

ASKER

You may use SSDT from within Visual Studio as well. :
Exactly, that's exactly I was trying to do now. 
Avatar of RIAS

ASKER

User generated image User generated image
No but you have SSDT which is inside VS. You don't really needs SSMS... Please have a look in Visual Studio after installing SSDT (I will be surprised if it is not installed already):
View -> SQL Server Object Explorer -> SQL Server -> TargetDB -> Tables -> Right Click -> Script As..
Similarly you can use 
Programmability -> Stored Procedures for SP
Views -> for View

Avatar of RIAS

ASKER

Ok, just checking that. Thanks a ton.
Avatar of RIAS

ASKER

Chinmay, The picture is of SSDT:
User generated image
Avatar of RIAS

ASKER

User generated image
Refer to my earlier comment:
View -> SQL Server Object Explorer -> SQL Server -> TargetDB -> Tables -> Right Click -> Script As..

Avatar of RIAS

ASKER

 TargetDB -> Tables -> Right Click -> Script As.
No not that option, I need to add the SQL server tools in VS 2019. Thanks a ton. Will not disturb you. 
Avatar of RIAS

ASKER

All sorted Chinmay, thanks!
SSDT is already installed. Good to hear that everything is sorted.
Avatar of RIAS

ASKER

it was not installed, had to modify the setup and check that option in other tools. Thanks
Avatar of RIAS

ASKER

User generated image
Interesting. I thought if you have SQL Server Object Explorer you should have everything. Thanks for this one. I shall keep it in mind.