[dbo].[HandleCRLFInMemos]
CREATE FUNCTION [dbo].[HandleCRLFInMemos]( @inSourceMemo varchar(max), @inMaxLength int )
returns varchar(max) as
begin
declare @theTempMemo varchar(max)
if( @inSourceMemo is not null )
begin
set @inMaxLength = case
when isnull( @inMaxLength, 0 ) <= 0 then 0
when @inMaxLength > 8000 then 8000
else @inMaxLength
end
set @theTempMemo = replace( replace( @inSourceMemo, 0x0D, '' ), 0x0A, 0x0D0A )
if( @inMaxLength > 0 and len( @theTempMemo ) > @inMaxLength )
begin
set @theTempMemo = substring( @theTempMemo, 1, @inMaxLength )
end
end
return @theTempMemo
end
GO
GRANT EXECUTE ON [dbo].[HandleCRLFInMemos] TO [MssExec]
GO