 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Gianni Filippini Guest
|
Posted: Thu Mar 15, 2007 3:40 pm Post subject: migration from Delphi_1 table, date 0.0 issue |
|
|
Hello Group,
I have to convert/restructure some tables written in delphi_1;
at that time date fields not significant were set to 0.0;
Database desktop shows the fields (defined as date) as 00/00/0000.
if now I open the tables in delphi_6 these fields cause the error:
"0.0 is not a valid timestamp"
To clear these fields I tryied the code below but I get the error
"type mismatch in expression".
I could reinstall delphi_1 and convert these fields from 0.0 to "clear"
since delphi_1 accept 0.0, But is there a way to work around ?
query1.SQL.Clear;
query1.SQL.add('update mytable ');
query1.SQL.add('set date9 = :wdate9');
query1.SQL.add('where date9 < 1');
query1.parambyname('wdate9').clear;
query1.execsql;
Many thanks in advance & regards,
Gianni Filippini |
|
| Back to top |
|
 |
Gianni Filippini Guest
|
Posted: Thu Mar 15, 2007 7:00 pm Post subject: Re: migration from Delphi_1 table, date 0.0 issue |
|
|
Bill, thanks for replying;
I use Paradox shipped with delphi_6
regards,
Gianni Filippini |
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Thu Mar 15, 2007 8:40 pm Post subject: Re: migration from Delphi_1 table, date 0.0 issue |
|
|
Gianni Filippini wrote:
| Quote: | Hello Group,
I have to convert/restructure some tables written in delphi_1;
at that time date fields not significant were set to 0.0;
Database desktop shows the fields (defined as date) as 00/00/0000.
if now I open the tables in delphi_6 these fields cause the error:
"0.0 is not a valid timestamp"
To clear these fields I tryied the code below but I get the error
"type mismatch in expression".
I could reinstall delphi_1 and convert these fields from 0.0 to
"clear" since delphi_1 accept 0.0, But is there a way to work around
?
query1.SQL.Clear;
query1.SQL.add('update mytable ');
query1.SQL.add('set date9 = :wdate9');
query1.SQL.add('where date9 < 1');
query1.parambyname('wdate9').clear;
query1.execsql;
Many thanks in advance & regards,
Gianni Filippini
|
What database are you using?
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Fri Mar 16, 2007 12:11 am Post subject: Re: migration from Delphi_1 table, date 0.0 issue |
|
|
IIRC, Paradox timestamp fields contain the number of milliseconds sine
/1/1/0000 so try the following:
UPDATE MYTABLE
SET THETIMESTAMP = NULL
WHERE THETIMESTAMP = '01/01/0000 00:00:00'
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Brian Bushay TeamB Guest
|
Posted: Fri Mar 16, 2007 5:42 am Post subject: Re: migration from Delphi_1 table, date 0.0 issue |
|
|
| Quote: | "0.0 is not a valid timestamp"
To clear these fields I tryied the code below but I get the error
"type mismatch in expression".
I could reinstall delphi_1 and convert these fields from 0.0 to "clear"
since delphi_1 accept 0.0, But is there a way to work around ?
query1.SQL.Clear;
query1.SQL.add('update mytable ');
query1.SQL.add('set date9 = :wdate9');
query1.SQL.add('where date9 < 1');
query1.parambyname('wdate9').clear;
query1.execsql;
|
Try this SQL
Update "mytablef"
set date9 = null
where Date9 < '1/1/1900'
--
Brian Bushay (TeamB)
Bbushay (AT) NMPLS (DOT) com |
|
| Back to top |
|
 |
Gianni Filippini Guest
|
Posted: Fri Mar 16, 2007 2:36 pm Post subject: Re: migration from Delphi_1 table, date 0.0 issue |
|
|
Bill, Brian,
thank you for replying,
I solved :
query1.SQL.clear;
query1.SQL.add('update myTable');
query1.SQL.add('set date9 = null');
query1.SQL.add('where CAST(date9 AS DATE) < :myDATE');
query1.PARAMbyname('myDATE').asdatetime := strtodate('01/01/1900');
query1.ExecSQL;
regards,
Gianni Filippini |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|