Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nesting functions in queries 4

Status
Not open for further replies.

Otinauj

Programmer
Oct 22, 2014
4
AR
Hi everyone, I'm a rookie in VFP, & I'm having some troubles with Select SQL command. It seems to be a dumb brother of SQL Server. I'm working with a previously developed code just trying to fix some stuff. Version of VFP is 9 sp1. It really do not accept nested functions? Thanks in advance for any answer.
 
It probably doesn't, but there's probably a different way to skin the cat.

Without providing an example of the code that failed, though, you probably won't get much help.

 
VFP SQL dialect surely isn't T-SQL, but you can
1. Use user defined functions in SQL
2. use other user defined functions within a user defined function (nested functions)

So as dan asks, what code doesn't work?

Bye, Olaf.
 
Hey guys thanks for answers. About code there is a lot of them , in Spanish & it probably take a bunch of lines to describe my C funtions .Thing is only I get are errors 1842 (Sub query nesting is to deep ?? whit 3 levels of queries and two functions????) and error 1845 ( expression is too complex ????). Anyways Olaf opened my eyes. VFP appears to not be a real database engine, but some Microsoft half way "solution" moved by some kind of "dialect".

I prefer rewrite tho whole thing in Real SQL, than struggle with some Billy G. piece of garbage.

THANKS a bunch for your time.

Otinauj ( Juanito)

 
Hi Otinauj, and welcome to the forum.

You say that VFP's Select SQL "seems to be a dumb brother of SQL Server". You might be confused about the differences. As I'm sure you know, SQL Server is not a command, or even a dialect of SQL. It is a client-server database management system which supports a version of SQL called T-SQL. VFP, on the other hand, is an application development system and programming language which has built-in data-handling capabilities. Amongs the many commands and functions that the VFP language supports is the common SQL commands.

In both systems, the SQL dialect is based n Ansi-92 SQL, but that doesn't mean that they are the same dialects. In moist ways, they are mutually compatible, but they both have additional features, and in some respects they work differently.

Now, to answer your question, I'm not sure what you mean by "nested functions" in a query. Do you perhaps mean sub-queries, for example: [tt]SELECT .... FROM .... WHERE x IN (SELECT .... FROM .....)[/tt]? That query is certainly valid in VFP, as are the following: [tt]SELECT x, (SELECT ... FROM ....), y FROM ....[/tt] and [tt]SELECT x FROM ... JOIN (SELECT ... FROM ...) AS .... ON ....[/tt].

Or perhaps you meant that you want to include function calls in a SELECT, such as [tt]SELECT ALLTRIM(x) AS ... FROM ...[/tt]? If so, then that is supported as well.

If that's not what you mean by "nested functions", perhaps you could clarify what your question.

Finally, I suggest that you will get a better answer to questions posted here (or in any other forum) if you focus on the technical issues. You're not going to win any friends here by referring to a tool that most of use every day as "some Billy G. piece of garbage".

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Knowing the history of Foxpro, I was amused by "some Billy G. piece of garbage".[bigsmile]
I ask myself what is Access, and what is SQL Server [wink]

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
It's quite useless to feed trolls. If he'd copy his T-SQL into a db2 or oracle database, that would most probably also be judged as piece of garbage. Just let him go. He's had his share of frustration, I won't wast any empathy on this.

If he's in need to work with DBFs, he'll surely calm down and return, when having a better day.

Bye, Olaf.
 
Derp derp-a-derp.
I am always entertained by a post which includes "VFP rookie" or "VFP newbie" wherein the OP starts to complain about the shortcomings of VFP, when really it is their own shortcomings. In other words, don't try to point out how old and rusty my tools are then ask me how I use them to fix your car.
... a dumb brother of SQL Server.
VFP is really the genetically selected parent of SQL Server.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Sorry guys if "piece of garbage" was offensive to you but really it seems to dont comply with ány ANSI satandars ( this is my personal oppinion, that's the reason to ask about info). About "feeding trolls" I love you too. Actually I work With DBFs (MySQL) since its very beginning. Just this customer have some code in VFP that needs to be repaired/revised & the reason of my inquiry in this forum. If I'm having a bad day, Who doesn't? If I'm a rookie in VFP? ,take for sure it is naked truth. Never been here before.
I apologize about any inconvenience.

Otinauj
 
By the way, when I open an ODBC connection, via a VFP query, it still open for ever?
 
You can think whatever you like, but if you only come here complaining and not showing any query/code, that we might review for you, you can't expect any advice. You don't have any specific question, you only state your frustration, and that continues. There's nothing we can do for you. I can point you to SYS(3055) as one possible way to do more complex WHERE clauses, but there aren't any switches to allow more than 128 recursions (it's a stack level limitation, not a function nesting limitation).

Perhaps your data simply has a circular reference and that's all to it, don't know. My glass ball is very cloudy, so I gave it to the cleaner.

Bye, Olaf.
 
Everyone has sh__ty days. You can't be faulted for that.
Since there usually at least 10 or so different ways to accomplish a given task in VFP, (USE/APPEND, OPEN, INSERT, ... for example) perhaps the original code written was in place back in oh, 2.5, 3.0 or even 6.0 days when yes, VFP SQL statements weren't as compliant as they evolved to be. So yes, there could be some syntactical garbage or non-ANSII methodology in there.
However, if you don't want to show examples or ask about specific functionality, AND more importantly, be willing to contribute back, this forum isn't going to server your purpose. It was never designed as a substitute F1 key. It's more of a technical information exchange. If all you need is another F1 key, go to google and poke around some more for technical specifications and command syntax. You'll find tons of examples and articles there.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Actually I work With DBFs (MySQL) since its very beginning.

You betray again your fundamental lack of knowledge. DBF (as used in the Foxpro context) is the native file format of VFP (which originate with dBase on CP/M). It has nothing to do with MYSQL, and pre-dates MYSQL by at least 20 years. (Most of us do too!)

I ask the same thing I asked earlier, with no judgement or admonishment, what code is not working? What have you tried? What error messages have you received?

Human language is irrelevant. Here, we all speak Foxpro.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top