DECLARE @var VARCHAR(100) = 'ABC' + CHAR(13) + CHAR(10); ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drones and Model Aircraft Meta

Q&A for experienced flyers, pilots, and builders of drones and model aircraft

DECLARE @var VARCHAR(100) = 'ABC' + CHAR(13) + CHAR(10);

SELECT @var = CASE WHEN @var LIKE '%' + CHAR(13) + CHAR(10) 
                  THEN LEFT(@var, LEN(@var) - 2)
                  ELSE @var
              END;
                  

SELECT @var, LEN(@var);

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results