PRB: Connectivity Error: Not a Recognized Built-in Function
Article ID: 140575
Article Last Modified on 10/15/2003
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Data Access Components 2.5
This article was previously published under Q140575
SYMPTOMS
When trying to run or browse a remote view, you may receive a Connectivity
error similar to this one:
Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL
Server]'CTOD' is not a recognized built-in function name
CAUSE
The CTOD function is added by the user as one of the Output fields, Order
By, or Group By fields, or it is added by the View Designer as part of the
Selection Criteria. CTOD is a FoxPro-specific function that is not
recognized by the SQL Server.
When browsing the Remote View, FoxPro passes the SQL command (listed in the
Remote View SQL window) to the back-end server for execution. A
connectivity error message is generated when any of the FoxPro-specific
functions are passed to the back-end server.
RESOLUTION
The View Designer problem in Microsoft Visual FoxPro version 3.0 for
Windows is fixed in Microsoft Visual FoxPro version 3.0b for Windows. In
version 3.0, the view designer added the CTOD to the WHERE clause whenever
a Selection Criteria on a Datetime field is added to the view. Version 3.0b
does not add the CTOD automatically. Currently, 3.0b requires that the date
in the example be surrounded by single quotation marks.
Steps to Work Around Problem
- Create an updatable View using SQL Passthrough. Use one of the SQL
Server built-in functions or remove whatever the View Designer added.
For information about creating an updatable View, please see the
following article in the Microsoft Knowledge Base:
138094 How to Create Updatable Views by Using SQL Passthrough
Following is an example of an SQLEXEC command that queries the Employee
table for a range of dates in the Hire_date field and then returns only
the date portion of the datetime field:
=SQLEXEC(Handle, "SELECT emp_id, ;
STR(datepart(month,hire_date),2) + '/';
+ STR(datepart(day,hire_date),2) + '/' ;
+ STR(datepart(year,hire_date),4) AS 'The_hire_date' ;
FROM employee ;
WHERE hire_date >= '01/01/93' AND hire_date <= '12/31/93'")
Note: STR() and datepart() are Microsoft SQL Servers built-in functions.
- Remove all FoxPro-specific functions from the Remote View.
- Create a Local view based on the Remote View.
- Add the necessary functions or selection criteria to the Local View.
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
Additional query words: VFoxWin
Keywords: kbprb KB140575