SQL UPDATE very slow via Jet?

  • Thread starter Thread starter mtnorwood
  • Start date Start date
M

mtnorwood

Guest
I am using Access 2000, and have a database with about 50,000 records across 15+ similar tables. One of my routines performs an update of a record within any table:

strSQL = "UPDATE [" & strTableName & "] SET "
"[" & strFieldName & "] = '" & strValue & "' "
"WHERE [Index] LIKE '" & strIndex & "'"

I then execute this query:
dbs.Execute strSQL, dbSQLPassThrough + dbFailOnError

It can take up to 2-3 seconds to complete, against a table with the "Index" field as the primary key. The target tables for this query are linked from another Access database on the same 100Mb network as the code executing the query. The "Index" field is dbText, as are the rest of the fields.

Is there any way to speed up this query?

Thank you for any assistance.
 
As long as you use the LIKE operator the query will always be suboptimal even if the field is indexed.
 
Thank you both for this suggestion. Since I am matching an exact, full-field string, the LIKE operator was something I was using from habit, not necessity. I have removed it, and things have sped up considerably.
 

Users who are viewing this thread

Back
Top Bottom