||Re: Trouble using SQL Server len() function in database call
Ken Mayer <firstname.lastname@example.org>
||Wed, 11 Oct 2017 21:05:04 -0700
On 10/11/2017 6:53 PM, Richard Tingle wrote:
> 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
Not sure if this would solve it, but perhaps try putting a table
reference in for the field in the function call:
len( property.locnumb )
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm