is there a way to auto-gen crud sprocs in ssms 2017?

  • Is there a way to auto-gen CRUDsprocs in SSMS 2017? For example, a basic User table might just need cookie cutter CRUD sprocs. I know there were some after-market tools that auto-genned sprocs for a given SS table 10 years ago. I was wondering if this functionality is built into SSMS now. If not, then what are some of your favorite tools to accomplish this?

  • I don't know about you, but don't you think developers should be able to write a CRUD sproc in a matter of a few minutes?   Generating a CRUD sproc seems like it's likely to waste more of your time trying to conform the code to company standards than just writing it to spec in the first place.   I'd actually worry about a developer's skillset if they came to me to ask that question.

    Steve?(aka sgmunson)?:) 🙂 :)?
    Health & Nutrition
    Make Guaranteed Income

  • I've just written scripts to do this. We have some here at the site: http://www.sqlservercentral.com/scripts/T-SQL/67368/

  • I've got a dozen scripts and functions to generate CRUDs and Change Scripts that I've been perfecting for 10 years and just rewrote them to be even cleaner and more powerful.  They use their own simple template language.  I use them on several projects to generate dozens of procs per table for the 500+ tables in each project.  About 20% of generated ones get converted into custom procs by developers and the generator is wise enough to not overwrite customized ones.  I've been wanting to write a tutorial article demonstrating these generators but it may take me a couple months to get it packaged and elegantly written up.

  • If you have your databases in an SSDT database Project you can use T4 templates to generate CRUD procedures.  I've also used written T-SQL to generate them, but since I try to always have my databases in database projects and source control, I now prefer T4 templates in SSDT.  Here's a link to a presentation I do on it and it has examples.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

Viewing 5 posts - 1 through 5 (of 5 total)

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