>I have a table with close to 1 million records. My program imports new records from a text file selected by the user into this table. The table has a field listing the name of the file that each record came from. Is there an efficient way to search the table to see if a file already exists i.e. see if the file has already been imported. I'm currently using a simple select statement that searches for the filename in question but that has become incredibly slow.
>
>Kris H.
Is the table indexed at all? If not, you could add an index on the filename field and perform simple seek() to determine if the file name exists.
The SQL statement is going through the entire table to find all occurences of the file name you specify. Without an index, it has to do a brute force comparison for all records. As your table continues to grow, it will keep getting slower and slower.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao