DECLARE @str VARCHAR(128)
SET @str = RTRIM(LTRIM(
'Line 1' + CHAR(13)+CHAR(10)
+ 'Line 2' + CHAR(13)+CHAR(10)
+ 'Line 3' + CHAR(13)+CHAR(10)
+ 'Line 4' ))
SELECT
@str
, (LEN(@str) - LEN(REPLACE(@str, CHAR(13)+CHAR(10), ''))) / 2
+ IIF( CHARINDEX(CHAR(10)+CHAR(13), REVERSE(@str), 0) = 1, 0, 1)
AS strNoOfLines
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment