23 lines
503 B
Transact-SQL
23 lines
503 B
Transact-SQL
CREATE FUNCTION [C6Mart].[getCreditRiskClass]
|
|
(
|
|
@ully as decimal(10,3),
|
|
@NumTitRc as smallint
|
|
)
|
|
RETURNS smallint
|
|
AS
|
|
BEGIN
|
|
-- Declare the return variable here
|
|
DECLARE @creditClassRisk as smallint
|
|
SET @ully = @ully/100
|
|
-- Add the T-SQL statements to compute the return value here
|
|
IF @NumTitRc > 0
|
|
begin
|
|
SELECT @creditClassRisk =
|
|
profilo
|
|
from C6Mart.[CODIFICA_CREDITRISK]
|
|
where min_val <= @ully and @ully <= max_val
|
|
end
|
|
else
|
|
set @creditClassRisk = null
|
|
RETURN @creditClassRisk
|
|
END |