Board index » delphi » HELP!: Using filters on SQL DELETE's

HELP!: Using filters on SQL DELETE's

greetings,

i'm trying to create an SQL statement which removes old statistical records
from my paradox type 7 database (delphi 32bit version 2.01):

I thought that my run-time created routine

DELETE FROM Statistics WHERE [DATE]<='01/01/97'

would work, but it doesnt like the date field (tried losing the [] and
placing ## around date, no luck) modified it to read:

DELETE FROM Statistics WHERE DATE<=:ShiftDate

And defined ShiftDate as a date field and used the OnGetText event to
assign the variable date.

This didnt work.

Then I tried adding a filter at run-time and using a generic sql

DELETE FROM Statistics

But that ignores the filter and deletes everything!

Help!  What am I doing wrong ?

--
pax,
simon <NeMeS...@tpgi.com.au>

 

Re:HELP!: Using filters on SQL DELETE's


I have had a similar type of problem. date seems to be a reserved word
in SQL, hence you cannot use it. Change the field name to something
beside date and the SQL will work

In article <01bc4afc$e2ba3780$bba50ccb@smckenna>, Simon McKenna
<NeMeS...@tpgi.com.au> writes

Quote
>greetings,

>i'm trying to create an SQL statement which removes old statistical records
>from my paradox type 7 database (delphi 32bit version 2.01):

>I thought that my run-time created routine

>DELETE FROM Statistics WHERE [DATE]<='01/01/97'

>would work, but it doesnt like the date field (tried losing the [] and
>placing ## around date, no luck) modified it to read:

>DELETE FROM Statistics WHERE DATE<=:ShiftDate

>And defined ShiftDate as a date field and used the OnGetText event to
>assign the variable date.

>This didnt work.

>Then I tried adding a filter at run-time and using a generic sql

>DELETE FROM Statistics

>But that ignores the filter and deletes everything!

>Help!  What am I doing wrong ?

--
Darren Guy

Re:HELP!: Using filters on SQL DELETE's


Darren Guy <dar...@colonials.co.uk> wrote in article
<EnidvCAmD5VzQ...@colonials.co.uk>...

Quote
> I have had a similar type of problem. date seems to be a reserved word
> in SQL, hence you cannot use it. Change the field name to something
> beside date and the SQL will work

Thanks for your reply Darren.

I was able to overcome the problem by using InfoPower's wwFilter (on their
wwTable) directly.

I will remember the experience and your advice though, ta :)

Other Threads