• sqlfriends (11/28/2012)


    Koen Verbeeck (11/28/2012)


    ^ is the negation. So %[^0-9.-]% means "every character that is not 0 through 9, a dot or the minus symbol".

    LIKE (Transact-SQL)

    Thanks, and thanks for site link, it makes more sense to me now.

    If this is the case, I think I don't need to include . and - sign.

    Because my building code always is a number, no negative, no decimals.

    So shall I just use

    not like %[^0-9]%

    This is actually a double negation, so the following should work as well:

    LIKE '%[0-9]%'

    Be aware that using the % symbol at the start of a LIKE clause won't have good performance, as an index can't be used.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP