Title: Message

Jeremy

 

Why not use :

  SELECT *

  FROM table

  WHERE @number LIKE location + ‘%’

?

 

Stephen

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Coulter
Sent: Friday, 8 October 2004 8:31 a.m.
To: [EMAIL PROTECTED]
Subject: [DUG] there has to be a better way to do this....

 

HI All.

 

We have a database that stores phone numbers but Country Code and location code.

 

i.e. 0061 - australia,  786 - gold coast

 

We pass a number to a function, and this function finds where the number is for.

 

The location code has a max length of 9 numbers, and so what I do is currently loop FOR x:=9 downto 1, and it querys the DB i.e. select * from the_table where location = copy(number,1,x)

BUT I REALLY thik this is bad...whilst it works, its not prob. the best thing to do....i.e. potentually 9 querys to a db.

 

There HAS to be a better way to do this !

I did think maybe of storing the data into a collection and itterating thru the collection which would be a HELL of a lot faster than going to the DB, but how obscene would it be to store over 1500 records into memory?

 

I thought there might be away to do it even in an SQL statement, but I cant think of how to structure it....this is an Access DB too, although after xmas it will be MS SQL Server (and MSDE).

 

If anyone has some thoughts, let me know.....this should get the list going again :-D

 

Jeremy

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This communication contains information that is confidential and the copyright of ensynergy Limited or a third party.

If you are not the intended recipient of this communication please delete and destroy all copies and telephone ensynergy Limited on +64 9 3551591 immediately. If you are the intended recipient of this communication you should not copy, disclose or distribute this communication without the authority of ensynergy Limited.

Any views expressed in this communication are those of the individual sender, except where the sender specifically states them to be the views of ensynergy Limited.

Except as required by law, ensynergy Limited does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to