sql asp 500pts

WhereString =   "SubString(Stock_Master.Bond_No,6,len(Stock_Master.Bond_No)) ='" & bondno & "' ORDER BY Stock_Master.Bond_No asc"  
I have partial of sql statement, and above sql code makes my query really slow. Is anyway I can use some other codes to make it faster?
500pts                                        
riskyricky1972Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
for sql 2000:
create a computed column for the substring() expression, index that field, and do the search using that computed column


if it had been for oracle:
create a function-based index on that substring() expression, and the query would take that index automatically without changing that query
0
 
dportasCommented:
Is this for Oracle or SQL Server or something else? It's always wise to state the product and version.

Try using a LIKE expression in place of = and SUBSTRING.

Your code looks dangerously vulnerable to SQL injection. There will be a proper way to do parameterisation in your host language of choice and you really ought to be using it.
0
All Courses

From novice to tech pro — start learning today.