If you're new to stored procedures, you may find our freebie Stored Procedure Wizard useful. You can download a free copy from www.ProductivityEnhancement.com.
My suggestion on your stored procedure is to just place all your logic for this in a single stored procedure and keep it as simple as possible. Also, declare variables containing each CAST value and then reuse that variable rather than recalling CAST. Hope this helps. :) Respectfully, Adam Phillip Churvis Advanced Intensive ColdFusion MX Training http://www.ColdFusionTraining.com E-mail: [EMAIL PROTECTED] Phone: 770-446-8866 ----- Original Message ----- From: "Jamie Jackson" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, July 25, 2002 12:00 PM Subject: New to SPROCs... > I've got an MSSQL 2000 sproc that has a lot of repetition that can > probably be abstracted. Please let me know if there's a good way to do > this: > > <this is just a snippet> > ALTER PROC sp_DAexport > > AS > > SELECT > ID, > cast((round(cast(q7years as decimal) + (cast(q7months as decimal)/12), > 1)) as decimal(18,1)) as q7, > cast((round(cast(q8years as decimal) + (cast(q8months as decimal)/12), > 1)) as decimal(18,1)) as q8 > FROM dbo.Respondents > > I'd like to wrap the math and maybe the aliasing into a sub-sproc > funtion, but I don't know if/how I can do it. Here's a _bad_ syntax > version of what I'm after: > > SELECT > ID, > sp_calcYears('7'), > sp_calcYears('8') > FROM dbo.Respondents > > Thanks, > Jamie > ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

