BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

migration from Delphi_1 table, date 0.0 issue

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Gianni Filippini
Guest





PostPosted: Thu Mar 15, 2007 3:40 pm    Post subject: migration from Delphi_1 table, date 0.0 issue Reply with 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
Back to top
Gianni Filippini
Guest





PostPosted: Thu Mar 15, 2007 7:00 pm    Post subject: Re: migration from Delphi_1 table, date 0.0 issue Reply with quote



Bill, thanks for replying;

I use Paradox shipped with delphi_6
regards,
Gianni Filippini
Back to top
Bill Todd
Guest





PostPosted: Thu Mar 15, 2007 8:40 pm    Post subject: Re: migration from Delphi_1 table, date 0.0 issue Reply with quote



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





PostPosted: Fri Mar 16, 2007 12:11 am    Post subject: Re: migration from Delphi_1 table, date 0.0 issue Reply with quote

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





PostPosted: Fri Mar 16, 2007 5:42 am    Post subject: Re: migration from Delphi_1 table, date 0.0 issue Reply with quote

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





PostPosted: Fri Mar 16, 2007 2:36 pm    Post subject: Re: migration from Delphi_1 table, date 0.0 issue Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.