#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Substring dont get all chars?


    Hello I have problem with getting proper data from database.
    1) I have query :
    Code:
    select Nazwa, IDTOWR, ODPLT from leki l , TOWR t
    where t.id=l.IDTOWR
    and it returns

    http://i47.tinypic.com/2mc5zqt.jpg
    2) When I make
    Code:
    select Nazwa, IDTOWR, ODPLT from leki l , TOWR t
    where t.id=l.IDTOWR and upper(SUBSTRING(ODPLT FROM 72 FOR 72)) = 'X'
    i get

    http://i48.tinypic.com/2jfonb.jpg
    As you see I don't get items with idtowr 26, 27... but they got x on 72 position. I'm using Firebird 2.5. Plz tell me what I'm doing wrong. Thank you in advance for you help and sorry for my English.
    Last edited by big200; June 13th, 2012 at 03:58 AM. Reason: No images
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    43
    Rep Power
    4
    The FOR part defines the number of characters you want to read and not the end position in the string, so it should be something like that:
    Code:
    SUBSTRING(ODPLT FROM 72 FOR 1)
    See also:
    http://www.firebirdsql.org/refdocs/l...substring.html

    Hope this helps.

    Thomas
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by tsteinmaurer
    The FOR part defines the number of characters you want to read and not the end position in the string, so it should be something like that:
    Code:
    SUBSTRING(ODPLT FROM 72 FOR 1)
    See also:
    http://www.firebirdsql.org/refdocs/l...substring.html

    Hope this helps.

    Thomas
    THX very much I got some bad translation in my program now all works fine.

IMN logo majestic logo threadwatch logo seochat tools logo