Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How will i use Alias in SQL Statement
Message
 
 
To
21/05/2005 03:01:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01016437
Message ID:
01016459
Views:
8
Abdulla,

VFP string constants are limited to 255 characters, you need to piece your overall SQL together in parts:
cSql = "Select EmpMst.EmpName As Name,EmpAtt.EmpDate As Date," + ;
   " EmpAtt.EmpAtt As AttHrs,EmpAtt.EmpRate As Rate" + ;
   " From BetaSql.dbo.EmpMst,BetaSql.dbo.EmpAtt" + ;
   " where Len(EmpMst.EmpCode) > 0 and EmpMst.Empcode = ?cEmpCode" + ;
   " And EmpMst.EmpCode = EmpAtt.EmpCode"
Since you are in VFP8 you might want to look at using the newer TEXT commands:
text to cSQL noshow
Select EmpMst.EmpName As Name,EmpAtt.EmpDate As Date,
   EmpAtt.EmpAtt As AttHrs,EmpAtt.EmpRate As Rate
   From BetaSql.dbo.EmpMst,BetaSql.dbo.EmpAtt
   where Len(EmpMst.EmpCode) > 0 and EmpMst.Empcode = ?cEmpCode
   And EmpMst.EmpCode = EmpAtt.EmpCode
endtext

? cSQL
This has the benefit that you can copy/paste the SQL statement between a tool like Query Analyzer and VFP.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform