Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 February 2nd, 2006, 09:52 AM
vero54 vero54 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 2 vero54 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 29 sec
Reputation Power: 0
Problem with STARTING WITH

I used 'like', but I want to firebird use my index.

my request :
select *
from mytable
where num_client starting with :client
( client = 'A' or all)
Maybe, :client starting with 'A'...and sometime, I want all client.

I use 'STARTING WITH :PARAMETER'
I've read in another thread :
using "starting with", if parameter is null will return all the data, else it will return the field that containt the parameter[/B]

but if my parameter is null, i've no line in response.

Reply With Quote
  #2  
Old February 6th, 2006, 02:52 AM
badukist badukist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 62 badukist User rank is Corporal (100 - 500 Reputation Level)badukist User rank is Corporal (100 - 500 Reputation Level)badukist User rank is Corporal (100 - 500 Reputation Level)badukist User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 3 m 18 sec
Reputation Power: 7
Send a message via Yahoo to badukist
Quote:
Originally Posted by vero54
I used 'like', but I want to firebird use my index.

my request :
select *
from mytable
where num_client starting with :client
( client = 'A' or all)
Maybe, :client starting with 'A'...and sometime, I want all client.

I use 'STARTING WITH :PARAMETER'
I've read in another thread :
using "starting with", if parameter is null will return all the data, else it will return the field that containt the parameter[/B]

but if my parameter is null, i've no line in response.


Use
select *
from mytable
where num_client starting with ''

Reply With Quote
  #3  
Old February 6th, 2006, 07:37 AM
vero54 vero54 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 2 vero54 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 29 sec
Reputation Power: 0
Thank you for your response.
My request :
client = '';
SELECT *
FROM MYTABLE
WHERE NUM_CLIENT starting with :client

And I have no ligne.

Reply With Quote
  #4  
Old February 6th, 2006, 03:14 PM
clivew clivew is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 810 clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 5 h 46 m 49 sec
Reputation Power: 19
Quote:
Originally Posted by vero54
Thank you for your response.
My request :
client = '';
SELECT *
FROM MYTABLE
WHERE NUM_CLIENT starting with :client

And I have no ligne.

First, you should get nothing if you pass in NULL. In SQL NULL IS NULL. It has no known value. Standard SQL operation is to ignore all NULLs in where clauses unless they are specifically specified by the clauses
Code:
where myField IS NULL
or
where MyField IS NOT NULL


As you appear to be searching for client names then if you are looking for null client names you will need to use a construct as above.

If you are trying to return ranges of values and use an index then why not use a BETWEEN clause?
Code:
where  NUM_CLIENT BETWEEN :FirstClient and :LastClient

Setting FirstClient to 'A' and LastClient to :zzz should return all names and use your index.

Clive

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Problem with STARTING WITH


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT