5 characters field

  • How can I select a field that contains only 5 charecters. Thank you

  • Assuming you mean the total length is 5 characters including any embedded spaces then..

    select foo from bah where len(foo) = 5

    or if the embedded spaces do not count

    select foo from bah where len(replace(foo,' ','') = 5

    If that is not what you needed can you post more details including full DDL of the table in question.

    Mike

  • Or select left(foo, 5) from bah

    The question was a tad ambiguous at best.



    Shamless self promotion - read my blog http://sirsql.net

  • Thank you

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply