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"

more ▼

asked Jan 09, 2012 at 04:20 AM in Default

yaqubonnet gravatar image

247 16 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, 2012 at 04:41 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
103k 19 21 74

+1 : definitely from code, especially if 2 similarly named procs "can have total different functionality"
Jan 09, 2012 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



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jan 09, 2012 at 04:20 AM

Seen: 689 times

Last Updated: Jan 09, 2012 at 04:20 AM