sql - Substring only if string length > 2 -
i wondering if possible substring if string length > 2? here sample statement: select substring(abresc, 1, 2) + '-' + substring(abresc, 3, 5) abresc table however, fields 2 chars long wondering if possible substring when longer 2 chars? you use case select abresc = case when len(abresc) > 2 substring(abresc, 1, 2) + '-' + substring(abresc, 3, 5) else abresc end table