ALTER FUNCTION [dbo].[TrimString](@string NVARCHAR(MAX),@TrimLength INT=0)
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @Result NVARCHAR(MAX);
SELECT @Result = CASE WHEN (LEN(ISNULL(LTRIM(RTRIM(@string)),''))> @TrimLength)
THEN '<span title="'+@string+'">'+ISNULL(SUBSTRING(ISNULL(LTRIM(RTRIM(@string)),''),0,@TrimLength),'')+'..</span>'
ELSE ISNULL(LTRIM(RTRIM(@string)),'')
END
RETURN @Result
END
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @Result NVARCHAR(MAX);
SELECT @Result = CASE WHEN (LEN(ISNULL(LTRIM(RTRIM(@string)),''))> @TrimLength)
THEN '<span title="'+@string+'">'+ISNULL(SUBSTRING(ISNULL(LTRIM(RTRIM(@string)),''),0,@TrimLength),'')+'..</span>'
ELSE ISNULL(LTRIM(RTRIM(@string)),'')
END
RETURN @Result
END
No comments:
Post a Comment