CREATE FUNCTION [dbo].[FullNote] (@ANote1 TEXT, @ANote2 TEXT, @ANote3 TEXT)
RETURNS VARCHAR(8000)

AS

BEGIN
	DECLARE @Return VARCHAR(8000)
	DECLARE @Delimiter VARCHAR(100)
	DECLARE @Note1 VARCHAR(8000), @Note2 VARCHAR(8000), @Note3 VARCHAR(8000)
	SET @Delimiter = '--------------------------------'
	SET @Note1 = ISNULL(CAST(@ANote1 AS varchar(8000)), '')
	SET @Note2 = ISNULL(CAST(@ANote2 AS varchar(8000)), '')
	SET @Note3 = ISNULL(CAST(@ANote3 AS varchar(8000)), '')
	Set @Return = ''
	IF @Note1 + @Note2 + @Note3 <> ''
		SET @Return = @Note1 + CHAR(13) + @Delimiter + CHAR(13) + @Note2 + CHAR(13) + @Delimiter + CHAR(13) + @Note3 + CHAR(13) + @Delimiter 

	RETURN @Return
	
	
END