Hi,<BR>I have posted this query on other forums and as yet have had no improvement. <BR>Can anybody else help me !!<BR><BR>I used to run a search via an IDC file / ODBC against a Visual Foxpro database on the webserver. The table contains approx 2.5 Million records but as the &#039WHERE&#039 clause was set up EXACTLY the same as an index on the table, the response was split second.<BR><BR>I am now trying EXACTLY the same query via an ASP page but I think it is now not using the index or something because response is now approx 1 minute !<BR><BR>My ASP code is:-<BR><BR>&#060;%<BR><BR>&#039 Open a recordset object<BR>set objRecSet=Server.CreateObject("ADODB.RecordSet") <BR><BR>&#039Create a Query that will Pull the information from the DataBase <BR>SQL_query ="SELECT Postcode,Healthauth, Lasthealthauth, Pcg, ha_code, pcg_name " <BR>SQL_query = SQL_query & "FROM main left outer join pcg on main.pcg=pcg.pcg_code "<BR>SQL_query = SQL_query & "WHERE (iif(at(&#039 &#039,alltrim(postcode))=0,alltrim(upper(postcode) ),alltrim(upper(substr(alltrim(postcode),1,at(&#03 9 &#039,alltrim(postcode))-1)+alltrim(substr(postcode,5)))))) = &#039PE100LD&#039 "<BR><BR>&#039 Run the query<BR>objRecSet.Open SQL_query, "DSN=postcode", 0 , 1<BR><BR>%&#062;<BR><BR><BR>Can anybody help me, I am getting a state with this.<BR><BR>Alec.