Remove first and Last char

  • Hi Team,

    How to remove first and Last chacter from below select query.

    SELECT LTRIM(RTRIM(REPLACE(col_1,'Year_',''))),

    FROM Years

  • How to remove first and last char from below select query

    SELECT LTRIM(RTRIM(REPLACE('Micro Soft','M','m')))

    output should be : 'icro Sof

  • SUBSTRING does what you desire.

    SELECT SUBSTRING(LTRIM(RTRIM(REPLACE('Micro Soft','M','m'))), 2, LEN(LTRIM(RTRIM(REPLACE('Micro Soft','M','m')))) -2 )

    -- Gianluca Sartori

  • Perfect...

    Thank You.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply