Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Default Return Value for Sproc ?

Author  Topic 

mj
Starting Member

25 Posts

Posted - 2001-08-24 : 12:05:05
I have a stored procedure that if passed a variable that does exist in the table, does not return a recordset. My question is, is there a way to return a default value from a stored procedure? I appreciate everyone's help on this. Below is the code for the sproc for reference:

CREATE PROCEDURE [up_Banker_Percent_For_Rev_RPT] @KeyNo int = null, @Bnkr varchar(3) AS







Begin
SELECT dbo.Bankers_Allocation.Percentage as Percentage, dbo.projections.deal, Projections.KeyNoFromDeal
FROM dbo.Bankers_Allocation INNER JOIN
dbo.Projections ON
dbo.Bankers_Allocation.DealID = dbo.Projections.PrimaryKey

Where Projections.KeyNoFromDeal = IsNull(@KeyNo, KeyNoFromDeal)
and bankers_allocation.bnkr = @Bnkr




end

What I'm trying to do is, if the value passed by @KeyNo does not match a value in the recordset, to return the value of 100 as the percentage.

Thank you everyone

   

- Advertisement -