I have seen some SQL Server stored procedure code generator which generates scripts on selecting a table.
Kindly recommend a free tool that generate SQL Server SP but what I am looking for is:
- It generate scripts in db, where user may not have to copy the code and execute the script in db.
- It can generate SP for a selected schema, I mean user may not need to select a table one by one, just on selecting db it may generate scripts for all tables.
Thanks
Try
http://www.codeproject.com/KB/database/Store_Procedure_Generator.aspx
SSMS Tools Pack has a nice fit with your requirements. It has also some very nice and useful features for sql server users.
The feature list is given below:
- Execution Plan Analyzer
- SQL Snippets
- Window Connection Coloring
- Tab Sessions, Window Content History, Query Execution History and
Current Window History
- Format SQL
- Search Table, View or Database Data
- Run one script on multiple databases
- Copy execution plan bitmaps to clipboard or file
- Search Results in Grid Mode
- Generate Insert statements from resultsets, tables or databases
- Regions and Debug sections
- Running custom scripts from Object Explorer
- CRUD (Create, Read, Update, Delete) stored procedure generation
- New query template
Try this new template-driven code generation tool.
www.metadrone.com
There is a stored procedure template on google code here: http://code.google.com/p/metadrone/source/browse/trunk/Templates/SQLServer_CRUDs.mdrone
To execute the script automatically add the runscript command after calling the template in MAIN. Eg:
call CRUDs(sources.SQL_Server)
runscript(sources.SQL_Server, "\path\goes\here\tablecruds.sql")
Some stored procedure generators:
General use
- CodeSmith Generator - commercial software
- MyGeneration - free
- Metadrone - free
SQL Server-specific
- SSMS Tools Pack
- Stored Procedure Generator
See also 1 and 2.
Tangentially related - one of the most interesting projects I have done so far involved writing my own database scripting utility, initially aimed at generating basic CRUD sprocs for each table in a (MS Access or MS SQL Server 2005) database, and then creating very basic class files represeting each class.
Of course, visual studio will also do this for you in a number of different ways out of the box. However, most of that implementation is tightly coupled with ADO.NET, LINQ, and EF.
If you don;t find one that does what you need, take a stab at it.
What I came up with was semi-crude and brute force, but the process was quite educational.
I have since been expanding it to generate a CREATE script for MS Access Databases (which Access does not provide out of the box).