Home Forums SQL Server 2005 T-SQL (SS2K5) ANYTHING THAT CAN HELP TRIM THE DATA FOR A GIVEN STRING... RE: ANYTHING THAT CAN HELP TRIM THE DATA FOR A GIVEN STRING...

  • Declare @myString Varchar(256)

    SET @MY STRING = 'A COSMETOLOGIST uses knowledge to do things to a client`s hair. A HAIRAPIST uses knowledge to give a customer guidance so she can do her own "hair improvement".

    there is 4 spaces after "HAIRAPIST", the replace would change from 4 spaces to two spaces, so it's misleading because there is still more whitespace than you expect to be there when you are done.

    Hate to think a loop should be used, most likely a tally table solution would help strip out doubler spaces;

    lemme try something and i'll post the results.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!