Board index » off-topic » Programatically creating Paradox Script files (.sql)

Programatically creating Paradox Script files (.sql)


2003-07-04 06:41:24 PM
off-topic15
Hi all,
I am aiming at creating a Paradox Script file (.sql) programatically so that
I can reuse that single file for all my querying needs.
I opened up an existing .sql file (created by Paradox) with Notepad and
found that it contained SQL Text in plain English with some comments.
I noticed that, when I created a script file manually with Notepad (with
some sql text in it), and saved it with a .sql extension, it works just fine
with in Paradox. But when I try to load it from Delphi (i.e. Select * from
mytest.sql ) it gives an error : Operator not applicable. However Delphi
successfully loads any sql scripts created by Paradox. BTW I use Delphi 5 as
my development tool.
Am I missing something? Is any encoding applied on text? Does any one know
how this could be done? I would appreciate some help.
Thnx in Advance,
Shafeeq.
 
 

Re:Programatically creating Paradox Script files (.sql)

I think your syntax needs to be something like:
Select * From "c:\myDir\Mytest.sql"
(i.e. you need the quotes around the table name when it's actually a file name, and you will likely need the full path to the file).
"Shafeeq JB" < XXXX@XXXXX.COM >wrote in message news:3f055aac$ XXXX@XXXXX.COM ...
Quote
Hi all,

I am aiming at creating a Paradox Script file (.sql) programatically so that
I can reuse that single file for all my querying needs.

I opened up an existing .sql file (created by Paradox) with Notepad and
found that it contained SQL Text in plain English with some comments.

I noticed that, when I created a script file manually with Notepad (with
some sql text in it), and saved it with a .sql extension, it works just fine
with in Paradox. But when I try to load it from Delphi (i.e. Select * from
mytest.sql ) it gives an error : Operator not applicable. However Delphi
successfully loads any sql scripts created by Paradox. BTW I use Delphi 5 as
my development tool.

Am I missing something? Is any encoding applied on text? Does any one know
how this could be done? I would appreciate some help.

Thnx in Advance,
Shafeeq.




 

Re:Programatically creating Paradox Script files (.sql)

Hi Bill,
Thanks for the response, Sorry that I didnt put it straight.
I meant that, I put a TQuery component on form and set its databasename
property to the required alias or path, then SQL property to 'Select * from
mytest.sql', where mytest.sql was created manually by notepad. Now when I
open the TQuery I get the message 'Operation not applicable'.
(Sorry its not 'Operator not applicable', I made a mistake earlier when I
reported it)
However TQuery successfully opens, if the .sql file was created by Paradox
(not Notepad.). And thats my issue.
I look forword to your response.
Thanking you,
Shafeeq.
"Bill Todd" < XXXX@XXXXX.COM >wrote in message
Quote
>I noticed that, when I created a script file manually with Notepad (with
>some sql text in it), and saved it with a .sql extension, it works just
fine
>with in Paradox. But when I try to load it from Delphi (i.e. Select *
from

What do you mean by, "load it from Delphi"? Can you show us the code?


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
 

{smallsort}

Re:Programatically creating Paradox Script files (.sql)

Chris,
Thnx for the response,
Sorry, I forgot to mention that I have set the Databasename property on a
TQuery component, and then its SQL property to 'Select * from mytest.sql'.
The situation was it works just fine with any .sql file created by Paradox.
All I am trying is to figure out why TQuery isnt working with .sql created
by a notepad, from my point of view. I would appreciate some ideas.
Thanks,
Shafeeq.
"Chris Pettingill" < XXXX@XXXXX.COM >wrote in message
Quote
I think your syntax needs to be something like:

Select * From "c:\myDir\Mytest.sql"

(i.e. you need the quotes around the table name when it's actually a file
name, and you will likely need the full path to the file).


"Shafeeq JB" < XXXX@XXXXX.COM >wrote in message
>Hi all,
>
>I am aiming at creating a Paradox Script file (.sql) programatically so
that
>I can reuse that single file for all my querying needs.
>
>I opened up an existing .sql file (created by Paradox) with Notepad and
>found that it contained SQL Text in plain English with some comments.
>
>I noticed that, when I created a script file manually with Notepad (with
>some sql text in it), and saved it with a .sql extension, it works just
fine
>with in Paradox. But when I try to load it from Delphi (i.e. Select *
from
>mytest.sql ) it gives an error : Operator not applicable. However Delphi
>successfully loads any sql scripts created by Paradox. BTW I use Delphi
5 as
>my development tool.
>
>Am I missing something? Is any encoding applied on text? Does any one
know
>how this could be done? I would appreciate some help.
>
>Thnx in Advance,
>Shafeeq.
>
>
>
>


 

Re:Programatically creating Paradox Script files (.sql)

Sujit,
Thanx again for the response,
Now, I have two .sql files :
1. Pdox.sql :
'Select ContractorId, (Title||' '||LastName||' '||Initials) as
ContName from Contractor'
2. Npad.sql :
'Select ContractorId, LastName from Contractor'
I noticed something here, when I manually typed in the contents of Pdox.sql
exactly into Npad.sql thru notepad,
Voila! It worked thru Delphi Tquery component, hence Notepad makes no
difference and my thoughts about Text Encoding is out.
I also noted something in addition, if an 'AS' doesnot appear in the SQL
statements of .sql file, Delphi throws the error 'Operation not applicable'.
It throws the above exception for the following, nomatter where they are
created (Paradox or notepad)
'Select * from Contractor'
'Select ContractorId, LastName from Contractor'
My question now is ,
Is there a way to solve this issue?
Is using .sql in Delphi really reliable?
Thanks,
Shafeeq.
"Sujit Singhania" < XXXX@XXXXX.COM >wrote in message
Quote
Shafeeq,

Can you show us whats in your SQL file?
I just wanted to compare the two SQL files, one created with Paradox (and
working fine in Delphi) and the other created thru Notepad (not working in
Delphi).

Sujit


"Shafeeq JB" < XXXX@XXXXX.COM >wrote in message
news:3f055aac$ XXXX@XXXXX.COM ...
>Hi all,
>
>I am aiming at creating a Paradox Script file (.sql) programatically so
that
>I can reuse that single file for all my querying needs.
>
>I opened up an existing .sql file (created by Paradox) with Notepad and
>found that it contained SQL Text in plain English with some comments.
>
>I noticed that, when I created a script file manually with Notepad (with
>some sql text in it), and saved it with a .sql extension, it works just
fine
>with in Paradox. But when I try to load it from Delphi (i.e. Select *
from
>mytest.sql ) it gives an error : Operator not applicable. However Delphi
>successfully loads any sql scripts created by Paradox. BTW I use Delphi
5
as
>my development tool.
>
>Am I missing something? Is any encoding applied on text? Does any one
know
>how this could be done? I would appreciate some help.
>
>Thnx in Advance,
>Shafeeq.
>
>
>
>


 

Re:Programatically creating Paradox Script files (.sql)

Hi Bill, Sujit,
Quote
feature of the BDE. You are using the same query processor in both
Paradox and Delphi
You are right Bill,
I just confirmed that, when I tried the same thing under Paradox, I got the
same message 'Operation not applicable'
i.e.
I made two .sql files in Paradox and ran it there.
1. one.sql =>'Select * from Contractor' (or 'Select Title, LastName from
Contractor)
2. two.sql =>'Select * from one.sql'
When I click the Execute button, I immediately get the message 'Operation
not applicable'.
Same is the case with all the tables. ( eg: one.sql =>'Select * from
Customer' )
So Sujit, I dont think it has anything to do with that Contractor table
which has no more than 15 records FYI.
I also have to point out that if one.sql contains an 'AS' keyword, it just
works fine. =>'Select Title as, LastName as Name from Contractor'
Now I see it as the behaviour of the BDE. Is there any remedy for this?
Thanks and Regards,
Shafeeq.
 

Re:Programatically creating Paradox Script files (.sql)

Sorry I made a typo in the last SQL statement it should read as
I also have to point out that if one.sql contains atleast an 'AS' keyword,
it just
works fine. =>'Select Title , LastName as Name from Contractor'
"Bill Todd" < XXXX@XXXXX.COM >wrote in message
Quote
Local SQL, the SQL dialect used for Paradox and dBase tables is a
feature of the BDE. You are using the same query processor in both
Paradox and Delphi. Local SQL is reliable. Querying a SQL file may or
may not be. I have never seen this technique documented as a supported
feature.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
 

Re:Programatically creating Paradox Script files (.sql)

Bill Todd wrote:
Quote
Local SQL, the SQL dialect used for Paradox and dBase tables is a
feature of the BDE. You are using the same query processor in both
Paradox and Delphi. Local SQL is reliable. Querying a SQL file may or
may not be. I have never seen this technique documented as a supported
feature.
See "SQL files" in "local SQL help" file index. ("Local SQL VEIWs")
--
Gert