Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 13th, 2012, 03:55 AM
big200 big200 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 2 big200 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 m 26 sec
Reputation 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
URL
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
URL
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

Reply With Quote
  #2  
Old June 13th, 2012, 08:55 AM
tsteinmaurer tsteinmaurer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 34 tsteinmaurer User rank is Lance Corporal (50 - 100 Reputation Level)tsteinmaurer User rank is Lance Corporal (50 - 100 Reputation Level)tsteinmaurer User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 5 h 2 m 19 sec
Reputation Power: 3
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/...-substring.html

Hope this helps.

Thomas

Reply With Quote
  #3  
Old June 13th, 2012, 09:09 AM
big200 big200 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 2 big200 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 m 26 sec
Reputation Power: 0
Quote:
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/langrefupd15-substring.html

Hope this helps.

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Substring dont get all chars?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap