select left sql code example
Example 1: sql left characters
-- For Oracle only
-- syntax
SUBSTR(<main-string>,1,<number-of-characters>)
-- example
SUBSTR('Useless stuff',1,10) -- OUTPUT: Useless st
-- practical example
SELECT SUBSTR('Useless stuff',1,10)
FROM DUAL;
Example 2: 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))))