Hi,
you have to use either ODBC Escape syntax or T-SQL. VFP functions don't work with SQL-Server. Have a look at the DATEPART() function of SQL Server and you will find what you need.
Additionally, you may not include "INTO TABLE TEMPTABLE". Results from SQLEXEC() are always stored in a cursor.
Regards,
Armin
>I need to extract some data e.g. phone nos based on date from sql db. I have inserted records in past in sql from vfp using
>
>sSql = "Insert into Abc (phone, clistcode ) "
>sSql = sSql + " values ('" + phone + "','" + listcode "')"
>z = SqlExec(nhandle,sSql,'')
>
>but I am not able to extract data from sql using query e.g.
>
>sSql = "select * from abc where YEAR(calltime)=2002 AND MONTH(CALLTIME)=10 AND day(calltime)=20 INTO TABLE TEMPTABLE"
>
>TIA
>
>Munish Arora