Subject Trouble using SQL Server len() function in database call
From Richard Tingle <>
Date Wed, 11 Oct 2017 21:53:17 -0400
Newsgroups dbase.getting-started


I have a dBASE executable that I compile for a website that allows users to pay property tax.  On the website, if the user does not know their account number they can search by their street name.  One of our clients wants the resulting search to be ordered by street number instead of account number.  We use SQL server for the database.  The street number data type in the database is varchar. My SQL select statement is

q.sql = "select * from dbo.Property where locstreet like '"+SearchKey+"%' and system = 'Property' ORDER BY len(locnumb), locnumb"

When I run the program and search I get the following error.  

Database Engine Error: Invalid use of keyword: (locnumb)

Any advice would be appreciated.  Thank you