If [vType] = "618" Or [vType] = "617" Then Select Case vGrade Case "DS*" [Points] = 180 Case "DS" [Points] = 150 Case "ME" [Points] = 105 Case "PA" [Points] = 45 Case "FL" [Points] = 0 Case Else [Points] = Null End SelectEnd If If [vType] = "622" Or [vType] = "623" Then Select Case vGrade Case "D*D*" [Points] = 360 Case "D*D" [Points] = 330 Case "DD" [Points] = 300 Case "DM" [Points] = 240 Case "MM" [Points] = 180 Case "MP" [Points] = 120 Case "PP" [Points] = 60 Case "FL" [Points] = 0 Case Else [Points] = Null End SelectEnd If If [vType] = "262" Then Select Case vGrade Case "DS*" [Points] = 180 Case "DS" [Points] = 150 Case "ME" [Points] = 105 Case "PA" [Points] = 45 Case "FL" [Points] = 0 Case Else [Points] = Null End SelectEnd If

SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO CREATE FUNCTION dbo.tf_Points(@Grade AS VARCHAR(10), @Type AS INT)IF @Type >0 BEGIN SELECT CASE WHEN @Type = '618' Or @Type = '617' AND @Grade = 'DS*' THEN 180 WHEN @Type = '618' Or @Type = '617' AND @Grade = 'DS' THEN 150 WHEN @Type = '618' Or @Type = '617' AND @Grade = 'ME' THEN 105 WHEN @Type = '618' Or @Type = '617' AND @Grade = 'PA' THEN 45 WHEN @Type = '618' Or @Type = '617' AND @Grade = 'FL' THEN 0 ELSE NULL END RETURNENDELSE

SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO CREATE FUNCTION dbo.tf_Points(@Grade AS VARCHAR(10), @Type AS INT)IF @Type = 618 or @Type = 617 BEGIN SELECT CASE WHEN @Grade = 'DS*' THEN 180 WHEN @Grade = 'DS' THEN 150 WHEN @Grade = 'ME' THEN 105 WHEN @Grade = 'PA' THEN 45 WHEN @Grade = 'FL' THEN 0 ELSE NULL END RETURNENDELSE

CREATE FUNCTION dbo.tf_Points( @Grade AS VARCHAR(10), @Type AS INT)RETURNS TABLEAS RETURNSELECT CASE WHEN @Type IN(618, 617, 262) THEN CASE WHEN @Grade = 'DS*' THEN 180 WHEN @Grade = 'DS' THEN 150 WHEN @Grade = 'ME' THEN 105 WHEN @Grade = 'PA' THEN 45 WHEN @Grade = 'FL' THEN 0 END WHEN @Type IN(622, 623) THEN CASE WHEN @Grade = 'D*D*' THEN 360 WHEN @Grade = 'D*D' THEN 330 WHEN @Grade = 'DD' THEN 300 WHEN @Grade = 'DM' THEN 240 WHEN @Grade = 'MM' THEN 180 WHEN @Grade = 'MP' THEN 120 WHEN @Grade = 'PP' THEN 60 WHEN @Grade = 'FL' THEN 0 END END