select len('' '') returning o

  • why is the len of a space zero what db option is this.

    please help this is messing many things up.

     

    many thinks

    www.sql-library.com[/url]

  • Hi Jules

    SQL BOL: Returns the number of characters, rather than the number of bytes, of the given string expression, excluding trailing blanks.

    In your exmaple space appeared to be last character in the string expression. Below example is self expainatory.   

    select len(' a')  = 2

    select

    len('a ') = 1

    select

    len (' ')  = 0

    use datalength instaed

    select

    datalength(' a')  =2

    select

    datalength('a ') = 2

    select

    datalength (' ')  =1

     

      

     

     

    Regards
    Shrikant Kulkarni

  • But beware!

    select datalength (N' ') = 2

    _____________
    Code for TallyGenerator

  • Hey Sergity,

    What does this "N" does to the sctrings ... i have seen some of these Ns when calling a system utilities also. Is this is a UNICODE marker of somekind ?

    FP


    FP

    True Love is Like A Ghost. Everyone Talks About It & Nobody have seen it.

  • That is correct.

    N'somestring' denotes that this is a unicode string

    /Kenneth

  • Thanks


    FP

    True Love is Like A Ghost. Everyone Talks About It & Nobody have seen it.

Viewing 6 posts - 1 through 5 (of 5 total)

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