Downloads What Is New? Contact Us Prior Events  
Home Contact Feedback Site Map
   
StoredProcBuilder

About us
Services
Downloads
Customer Sign-In
Prior Events



 


Stored Procedure Builder:    Click here to Download Now!

StoredProcBuilder is a utility geared towards developers using stored procedures. It generates the CRUD (Create, Insert, Update and Delete) stored procedures for tables in your database and provides a jump start to development. 

Here are three sample stored procedures generated for the Orders table in Northwind database. Generated stored procedures are GetOrders(), DeleteOrders() and SaveOrders. Instead of generating two separate procedures for Insert and Update StoredProcBuilder generates only a common Save() stored procedure. Save() is smart to determine if the incoming data is for an insert or an update. How does it do this?

The Builder automatically determines the primary key on the tables and builds the DeleteOrders() stored procedure using the primary key. In case of SaveOrders(), the builder generated the parameters along with the correct data types and uses the value of the primary key to determine if whether to execute an Insert on the table or an Update. The utility provides a config file, StoredProcBuilder.exe.config, and you can customize default connection string and prefix for your stored procedures.

The current version only supports SQL Server and has been fully tested for SQL Server 7 and 2000. The builder assumes that the primary keys are being generated using the built-in auto generated keys functionality in SQL Server.

StoredProcBuilder provides a great starting point for developers who intend to use stored procedures. It is a beauty and a BIG timesaver for building applications.

Did we mention it is free.
J Enjoy!
Download the latest version of StoredProcBuilder here and let us know what you think. Email: KamalP@ELLKAY.com


Northwind Database: GetOrders()
/*----------------------------------------------------------------
This stored procedure has been generated automatically 
using StoredProcBuilder (Version 1.0). To get the latest version of 
this builder and other downloads, please visit our site 
at http://www.ELLKAY.com.
----------------------------------------------------------------*/
CREATE PROCEDURE Ellkay_GetOrders
as
set nocount on
select OrderID,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,
	Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry 
	from [Orders]
 return
GO                            
 
Northwind Database: DeleteOrders()
/*----------------------------------------------------------------
This stored procedure has been generated automatically 
using StoredProcBuilder (Version 1.0). To get the latest version of 
this builder and other downloads, please visit our site 
at http://www.ELLKAY.com.
----------------------------------------------------------------*/
CREATE PROCEDURE Ellkay_DeleteOrders
@tOrderID int 
as
set nocount on
Delete from [Orders] where OrderID =@tOrderID
return
GO             
Northwind Database: SaveOrders()
/*----------------------------------------------------------------
This stored procedure has been generated automatically 
using StoredProcBuilder (Version 1.0). To get the latest version of 
this builder and other downloads, please visit our site 
at http://www.ELLKAY.com.
----------------------------------------------------------------*/
CREATE PROCEDURE Ellkay_SaveOrders
		@tOrderID  int,
		@tCustomerID  nchar,
		@tEmployeeID  int,
		@tOrderDate  datetime,
		@tRequiredDate  datetime,
		@tShippedDate  datetime,
		@tShipVia  int,
		@tFreight  money,
		@tShipName  nvarchar,
		@tShipAddress  nvarchar,
		@tShipCity  nvarchar,
		@tShipRegion  nvarchar,
		@tShipPostalCode  nvarchar,
		@tShipCountry  nvarchar
as
set nocount on
declare @nCount int
select @nCount = (select count(*) from [Orders]  where OrderID = @tOrderID)
if (@nCount = 0)
begin
	Insert into [Orders]
 		(OrderID,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,
		ShipVia,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,
		ShipCountry) 
		 Values (@tOrderID,@tCustomerID,@tEmployeeID,@tOrderDate,@tRequiredDate,
			@tShippedDate,@tShipVia,@tFreight,@tShipName,@tShipAddress,
			@tShipCity,@tShipRegion,@tShipPostalCode,@tShipCountry)
 	select @tOrderID = @@IDENTITY
 end
 else
 begin
 	update [Orders]  set 
		OrderID = @tOrderID,
		CustomerID = @tCustomerID,
		EmployeeID = @tEmployeeID,
		OrderDate = @tOrderDate,
		RequiredDate = @tRequiredDate,
		ShippedDate = @tShippedDate,
		ShipVia = @tShipVia,
		Freight = @tFreight,
		ShipName = @tShipName,
		ShipAddress = @tShipAddress,
		ShipCity = @tShipCity,
		ShipRegion = @tShipRegion,
		ShipPostalCode = @tShipPostalCode,
		ShipCountry = @tShipCountry
	where OrderID = @tOrderID
 end
 return
GO              

 

 

 

 

 


 
  
Copyright © 2003 ELLKAY, LLC. All rights reserved