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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pervasive sql statement 1

Status
Not open for further replies.

fluppe689

Programmer
Jul 11, 2008
75
BE
Hello SmartPeople,

I have a problem :
In a standard erp program with pervasive database there is a tabel called ORDER

my sql statement is
SQL = "select * from order " + chr(13);
"where volledig <>"+;
"'X'";
"order by ordernr"

the problem is that the table is called ORDER

When I use the pervasive query I must give
select * from "order".
the problem is the character "

Any suggestions ?

wfg,


Filip
 
Code:
TEXT TO lcSQL NOSHOW PRETEXT 15
     SELECT * FROM "Order"
            where volledig <> 'X'
     order by ordernr
ENDTEXT

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Or to use the approach you are atttempting...

Code:
SQL = "SELECT * FROM order";
      + " WHERE volledig <> 'X'";
      + " ORDER BY ordernr"

On another note - while it may not present a problem as it is, since the word ORDER has meaning in the VFP Command world, I would recommend changing your data table name reference within the code by using some alias.

Example:
Code:
USE Order IN 0 ALIAS OrdrDetails
SELECT OrdrDetails
* --- OR ---
SQL = "SELECT * FROM OrdrDetails";
      + " WHERE volledig <> 'X'";
      + " ORDER BY ordernr"

Good Luck,
JRB-Bldr
 
Or, yet another possisibility:

Code:
SQL = [select * from "order" ] + chr(13);
      "where volledig <>"+;
      "'X'";
      "order by ordernr"

By the way, are you sure you need the chr(13) in there? It probably does no harm, but it most SQL implementations, line breaks within commands are redundant.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
In VFP, you can use three different character combinations to delimit a string. The following are all equivalent:

'This is a string'
"This is a string"
[This is a string]

And you can combine then to get different characters inside the string. So in your case, you can use " inside like this:

'select * from "order" '

or

[select * from "order" ]

Craig Berntson
MCSD, Visual FoxPro MVP,
 
Thanks Mike,

your solution did perfectly match the problem.
another star for you

wfg,

Filip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top