x
login about faq Site discussion (meta-askssc)

Stored Procedure Redirect logic

We are developing an application where sometime we need to support more than one versions of that software at a time. For example Release 1-0-300 , 1-0-300-With-Test-FunctionalityA, Release 1-0-300-With-Test-FunctionalityB. Due to such requirements we sometime use the same Stored Procedure with different name in different versions for example

"1-0-300" uses Stored Procedures "USP_GetProucts"

"1-0-300-With-Test-FunctionalityA" uses Stored Procedures "USP_GetProucts_FunctionalityA"

"1-0-300-With-Test-FunctionalityB" uses Stored Procedures "USP_GetProucts_FunctionalityB"

Some Facts:

1- Why we are not using some alternate solution like we can have a Parameter "WhichStoredProcedureToCall" based on that parameter we can call the required STored Procedure? Because "USP_GetProucts" can have total different functionality than "USP_GetProucts_FunctionalityA" & these are huge stored procedures.

2- We are using SQL2008.

So my question is can we implement some type of "Stored Procedure Redirect", if "USP_GetProucts_FunctionalityA" not found then get the results form "USP_GetProucts"

Regards.

more ▼

asked Jan 09 '12 at 04:20 AM in Default

yaqubonnet gravatar image

yaqubonnet
247 11 17 20

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

You could do that directly from your code pretty easily.

But, you could build a wrapper procedure that calls other procedures. That's a pretty standard coding methodology. It's also easy to check the row count within a proc to determine if the previous call returned anything (or even return an output parameter that says no results were forthcoming) and then call another proc.

You have choices.

more ▼

answered Jan 09 '12 at 04:41 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
64.9k 13 20 66

+1 : definitely from code, especially if 2 similarly named procs "can have total different functionality"

Jan 09 '12 at 06:39 AM Kev Riley ♦♦
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1612
x609
x343

asked: Jan 09 '12 at 04:20 AM

Seen: 386 times

Last Updated: Jan 09 '12 at 04:20 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.