|
Jeremy Why not use : SELECT * FROM table WHERE @number LIKE location + ‘%’ ? Stephen From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Coulter HI All. We have a database that stores phone numbers but Country
Code and location code. i.e. 0061 - 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
