Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    3

    Unanswered: drawback of sybase len function

    Hi,there!

    I'm confused with the sybase built-in function len(),char_length,character_length,and datalength. For a NULL value,they return NULL,reasonable;for a string composed of one char,they return 1,reasonable again;but for an empty string,that's '',they also return 1,unbelievable!
    As with Microsoft SQL Server,everything goes well,len() return 0 for an empty string.
    I thought it might have something to do with ANSINULL,but whatever I set ANSINULL,ON or OFF,the results remain the same.
    Any suggestion is appreciated.Tons of thanks in advance.

  2. #2
    Join Date
    Jan 2004
    Posts
    51
    I think in sybase empty string '' is same as ' ' i.e. string with one space character.

  3. #3
    Join Date
    Jul 2004
    Posts
    3
    Quote Originally Posted by sushant
    I think in sybase empty string '' is same as ' ' i.e. string with one space character.
    Thank you! I got it.
    Then,a further question,how do we differ a meaningless string,such as NULL,empty string and space,from a string composed of one char(non-space)? Is there a simple function? Thanks.
    Last edited by tigerleo; 07-08-04 at 22:07.

  4. #4
    Join Date
    Jan 2004
    Posts
    51
    you may have to use rtrim , ltrim functions to remove any leading or trailing spaces..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •