Page 1 of 1

TVF_GetCodeName

Posted: Mon Feb 20, 2017 5:49 pm
by robinwilson16
Returns the name from the lookup table

Code: Select all

CREATE FUNCTION [dbo].[TVF_GetCodeName](@Code VARCHAR(10),@Domain VARCHAR(25))
RETURNS TABLE

AS

-- Function to return Code Description 
-- PH 2016-04-26


RETURN 
	SELECT
		Value = RTRIM(COALESCE(VC.vc_name,LTRIM(RTRIM(@Code)) + ' Not available'))
	FROM 
		ulive.dbo.caps_valid_codes VC
	WHERE     
		VC.vc_domain = @Domain 
		AND vc_code = @Code