• Superfast set based query (0.093 sec for a table of 10000+ records of 40-50 characters):

    CREATE TABLE [Numbers] (

    [PkNumber] [int] IDENTITY (1, 1) NOT NULL ,

    CONSTRAINT [Pk_Number] PRIMARY KEY CLUSTERED

    (

    [PkNumber]

    ) ON [PRIMARY]

    ) ON [PRIMARY]

    GO

    Declare @i as int

    set @i = 0

    while @i < 8000

    begin

    Insert into dbo.Numbers Default Values

    set @i = @i + 1

    end

    Select Distinct O.PkObjSQL, O.Name from dbo.ObjSQL O cross join dbo.Numbers N

    Where N.PkNumber 128

    This select makes a cross join for each PkNumber that is smaller or equal to the lenght of the string, then it uses the PkNumber to do the substring and test each character for an ascii number bigger than 128.