Scripting All Objects from SSMS in to a VCS

  • Comments posted to this topic are about the item Scripting All Objects from SSMS in to a VCS

  • How is this different from starting up Visual Studio and importing the database schema and then adding it to a VCS ?

    Create new database project and then choose Project - Import - Database... (using Visual Studio Community Edition 2015)

  • Is the script generation feature part of the PoSh functionality? I'm investigating solid methods to store and deploy SQL object code. There are shortcomings associated with the generated scripts that I need to clean up. Existing code management and deployment tools don't allow for customization of the script template (e.g. I want my DROP/CREATE statements to check for the existence of the table and the presence of records; scripts must run in object dependency order; etc.).

    tks
    PH

  • Hi,

    I've recently been investigating using Source Control to store/modify database objects scripts.

    The option described here is good as a one shot deal, but what is the best (and free) way to integrate it with Source Control so that database developers can check in/out the code?

    Has anyone implemented a good solution?

    Please advise.

    Thank you!

  • Hansiehans - Thursday, March 29, 2018 4:40 AM

    How is this different from starting up Visual Studio and importing the database schema and then adding it to a VCS ?

    Create new database project and then choose Project - Import - Database... (using Visual Studio Community Edition 2015)

    It's in SSMS. Plenty of people would prefer to work in that IDE as opposed to VS.

  • phegedusich - Thursday, March 29, 2018 6:28 AM

    Is the script generation feature part of the PoSh functionality? I'm investigating solid methods to store and deploy SQL object code. There are shortcomings associated with the generated scripts that I need to clean up. Existing code management and deployment tools don't allow for customization of the script template (e.g. I want my DROP/CREATE statements to check for the existence of the table and the presence of records; scripts must run in object dependency order; etc.).

    tks
    PH

    I'll get to PoSh in a later article. The short answer is no, but PoSh can access the SMO objects.

  • Negmat 18367 - Thursday, March 29, 2018 9:23 AM

    Hi,

    I've recently been investigating using Source Control to store/modify database objects scripts.

    The option described here is good as a one shot deal, but what is the best (and free) way to integrate it with Source Control so that database developers can check in/out the code?

    Has anyone implemented a good solution?

    Please advise.

    Thank you!

    You can repeat this as necessary for changes. I've got another article coming showing that.

    I don't know of a free solution that integrates SSMS with a VCS. There are paid products, such as SQL Source Control from my employer, Redgate Software, but none I know of that's free.

  • Understood - looking forward to the future article(s) showing how this could be automated and scheduled so that database object scripts are source controlled outside of developer involvement.

  • Steve Jones - SSC Editor - Thursday, March 29, 2018 9:28 AM

    Negmat 18367 - Thursday, March 29, 2018 9:23 AM

    Hi,

    I've recently been investigating using Source Control to store/modify database objects scripts.

    The option described here is good as a one shot deal, but what is the best (and free) way to integrate it with Source Control so that database developers can check in/out the code?

    Has anyone implemented a good solution?

    Please advise.

    Thank you!

    You can repeat this as necessary for changes. I've got another article coming showing that.

    I don't know of a free solution that integrates SSMS with a VCS. There are paid products, such as SQL Source Control from my employer, Redgate Software, but none I know of that's free.

    VS CE 2015 is a free tool and integrates with multiple VCS.
    I used 2 work from SSMS, but now I really believe that is a no-go.
    Deployment should be done from within VS, which also adds other benefits like searching, checkin-checkout, etc etc

  • Hi Hansiehans,

    Can you point me to some articles which describe how this process can be set up (i.e. the database developer's workflow) in terms of using VS to source control scripts of database objects.

    We use TFS for SSIS, but I could never figure out how to do the same with let's say stored procedures - unless I copy/paste stored procedure code, check in and after every edit, ALTER it in SSMS.

    Please advise.

    Thanks!

  • Negmat 18367 - Thursday, March 29, 2018 11:11 AM

    Hi Hansiehans,

    Can you point me to some articles which describe how this process can be set up (i.e. the database developer's workflow) in terms of using VS to source control scripts of database objects.

    We use TFS for SSIS, but I could never figure out how to do the same with let's say stored procedures - unless I copy/paste stored procedure code, check in and after every edit, ALTER it in SSMS.

    Please advise.

    Thanks!

    Hi,

    You use Google with Visual Studio Community Edition SQL Database Deploy
    I see 2017 edition is now available.

    Best result is this one I guess: https://www.visualstudio.com/vs/features/ssdt/

    In the summary it states exactly what you are looking for:

    Database Project
    Modernize your database development lifecycle
    Develop, build, test and publish your database from a source controlled project, just like you develop your application code. 
    Start from scratch with a new Database project, or import an existing database with a few clicks.

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply