SQL server according to the specified character string taken

SELECT
    '1234564/23',
    RIGHT (
        RTRIM(LTRIM('1234564/23')),
        len(RTRIM(LTRIM('1234564/23'))) + 1 - CHARINDEX(
            '/',
            RTRIM(LTRIM('1234564/23'))
        )
    ),
     left (
         RTRIM(LTRIM('1234564/23')),
         CHARINDEX(
             '/',
             RTRIM(LTRIM('1234564/23'))
         )-1
     ),
    len(RTRIM(LTRIM('1234564/23'))),
    CHARINDEX(
        '/',
        RTRIM(LTRIM('1234564/23'))
    );

If the target string is not / is left is problematic

Guess you like

Origin www.cnblogs.com/M4AkAcr/p/11111561.html