advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
SpBuilder
DogRegDB
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 3.5/5 | Rate this item | 2 users have rated this item.
 

Use XSLT to Write a Simple Stored Procedure Generator

Writing stored procedures (SPs) from scratch is boring and time consuming. Some tools may do it for you, but we all have our coding styles. Learn how to generate SPs the way you like best. 


advertisement
magine that you've just finished building a database for another Web-based system. Now it's time to start thinking about writing all that SQL to move the data in and out of the database. Being a security-conscious developer, you decide against building dynamic SQL in your data-tier code. You choose to do the right thing and write stored procedures (SPs). Daunting task, isn't it?


Stored procedures are much safer than dynamic SQL statements because the data coming from outside of the application is not mixed up with SQL DML (data manipulation language) statements. SPs pass the data as parameters, providing clear separation from the code:

spMySampleProc (@par1 int, @par2 nvarchar(100))

Writing stored procedures is not everyone's cup of tea because of the amount of work they require, however. Suppose you have 10 tables with a total of 100 fields. You likely will end up with at least 10 SPs for inserting data, 10 SPs for modifying data, 10 SPs for deleting records, and every SP will have almost as many in-parameters as there are fields in the table. OK, shall we do some code generation then?


How do I manage the amount of time and work required to write stored procedures from scratch?


Use XSLT to produce simple stored procedure boilerplates.

  Next Page: SP Design Model


Page 1: IntroductionPage 3: .NET Code
Page 2: SP Design Model 
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Help  |   Site Map  |   Network Map  |   About


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers