Generating crud scripts from table def?
ChrisDuncanMnx
Posts: 7
Hey, guys.
I'm new to the Redgate tools and quite enjoying the experience. I just wrote a batch of standard crud procs for a handful of tables and found the auto population of the insert statement to be time saving.
I was wondering if anyone has wired up the tool and / or snippets in such a way that I could point at a table and have it auto generate the create / update / delete procs from the table def.
Forgive the clueless question if this isn't how Sql Prompt works. That said, I figure if this sort of thing is possible I'm surely not the first person to think of it.
Thanks!
I'm new to the Redgate tools and quite enjoying the experience. I just wrote a batch of standard crud procs for a handful of tables and found the auto population of the insert statement to be time saving.
I was wondering if anyone has wired up the tool and / or snippets in such a way that I could point at a table and have it auto generate the create / update / delete procs from the table def.
Forgive the clueless question if this isn't how Sql Prompt works. That said, I figure if this sort of thing is possible I'm surely not the first person to think of it.
Thanks!
Christopher Duncan
Midnite Express
Midnite Express
Comments
Excellent news that you are enjoying using SQL Prompt.
You can create and add your snippets to use. Please vist this Web Page In the Learning SQL Prompt section, expand the topic "Speeding up your Queries" and take a look at the "Inserting snippets" and "Managing Snippets". This will help you create your own snippets to achieve your goal of automatically create / update and delete your Stored procedures.
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com
Thanks for the reply. I've looked at both of the pages you recommended but there's not much detail on either one.
In order for the snippet system to be able to automatically generate the create, update and delete procs based on a given table, there needs to be a way for it to take a reference to the table name, get the list of its column names and data types, and then use that in the generated code to populate the procs.
Are there other sources of information that I should be referencing to understand how I accomplish this?
Thanks,
Midnite Express
http://www.ssmstoolspack.com/Features?f=12
This has the ability to auto-generate CRUD Sprocs.
Hope this helps,
Justin
Developer
Redgate Software Ltd
Very cool, thanks for the link! Is this your stuff?
Midnite Express
I'd be interested to hear if it solves your problem sufficiently.
Thanks,
Justin
Developer
Redgate Software Ltd
By the way, I have the Redgate tools, which means Sql Prompt is installed. Do you happen to know if there's a conflict between the two? Seems like they do similar things so I don't know if they'll get into a cat fight over every character I type.
Midnite Express
Bovine deity.
Man, this would have saved me a ton of work the past week. Thanks!
Midnite Express
Justin
Developer
Redgate Software Ltd
Have you looked at CodeSmith (www.CodeSmthTools.Com) , you can set up extremely comprehensive templates that generate CRUD and lots of other code . There samples show you how, even to using full blown ORM's like NHibernate . Along with their own PLINQO ones
You can also Use T4 in VS to generate stuff , but it takes a bit more effort.
ALSO again there are INSERT DELETE and UPDATE templates in Sql Management Studio
Cheers
Mike