Hi Munish,
>sSql = "select * from abc where YEAR(calltime)=2002 AND MONTH(CALLTIME)=10 AND day(calltime)=20 INTO TABLE TEMPTABLE"
Obviously you've already gotten the answer. YEAR() and MONTH() are VFP functions and do not exist on SQL Server.
This is one of the reasons I'm NOT a big fan of SQL Passthrough and prefer to use stored procs for all data access and updates.
VFP compiles your code just fine because all it sees is a string even through the code is not correct. If you had a stored proc on the server, you would code it, test it, and then call it from VFP. Any changes to the stored proc would be automatically incorporated into your app and would NOT require a rebuild or redistribution of an EXE.
Just my $0.02...
Jim Duffy
Microsoft MVP
INETA Speaker
TakeNote TechnologiesDeveloper's Choice Award Winner for Best Training Company
Specializing in VB.NET, ASP.NET, VFP, and SQL Server Training and Development