• If the requirement is to remove trailing spaces and all trailing non-alpha-numerics Luis code is what's needed; but it seems a bit heavyweight if the requirement is just to eliminate trailing spaces and at most one '.'. If the requirement is just spaces and at most one '.' this simpler code will do instead:

    FROM SampleData;

    WITH SampleData(String) AS(

    SELECT 'ADB' UNION ALL SELECT

    'ADC. DCD.' UNION ALL SELECT

    'ADC.' UNION ALL SELECT

    'ABC DS.' UNION ALL SELECT

    'AD.' UNION ALL SELECT

    'DG@' UNION ALL SELECT

    'DGC DS ' UNION ALL SELECT

    'fdsf fs/' UNION ALL SELECT

    'fs fds //'

    )select CASE WHEN right( rtrim(String), 1) ='.'

    THEN rtrim(substring(String,1,len(String)-1))

    ELSE rtrim(String) END as NewString

    FROM SampleData;

    Tom