sql get first character of string code example
Example 1: sql server substring
SELECT SUBSTRING('SQL Tutorial', 1, 3) AS ExtractString;
Example 2: substring sql
SELECT SUBSTRING('SQL Tutorial', 4, (LENGTH('SQL Tutorial'))
AS LastCharactersString;
//Result -> Tutorial
Example 3: reading from right to left from string find first special characters in sql
DECLARE @strvalue varchar(20) = 'SDADH/SDKDS/SD/UIO-123/WEA/456'
SELECT REVERSE(SUBSTRING(REVERSE(@strvalue),0,CHARINDEX ('/',REVERSE(@strvalue))))