Home Forums SQL Server 2005 Development Remove set of characters between [abcd] in a variable RE: Remove set of characters between [abcd] in a variable

  • My 2 cents 🙂

    declare @table table(

    string varchar(50)

    )

    insert @table (string)

    select '[gdhdnuidd] 1st Party SW'

    union all select '[abcdef] Client'

    union all select 'testbusiness'

    select

    case

    when charindex(']',string) > 0 then right (string, (len(string)- charindex(']',string)))

    else string

    end finalstring

    from @table