Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any reason to store time in 8-char field?
Message
From
03/05/2008 16:12:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01314637
Message ID:
01314952
Views:
14
>Hi,
>
>I need to store time in a new field (I don't use TimeDate field yet). I don't really need to store seconds; hours and minutes is all I need. So, initially, I am thinking of making the new field 5 char long (e.g. "02:12"). But I am wondering, can someone offer a reason(s), why it might be better to create this field as 8 characters and store the seconds, even though I won't use them now. In the future update I will convert this database to a SQL Server and probably will combine another DATE field with this new TIME field into one DateTime.
>
>Thank you in advance for any input.

5 is good (at least). Don't go under 5 because you may need time values like 11:15 which have 4 digits. Don't try to save : if you think easy casting and future. 8 and 11 are optional and could be done later too by simply altering the size.

ie:
cast(myTime as datetime) simply works both in VFP and SQL server when you go with hh:mm format.
cast('0:0' as datetime) works in SQL server but not '0' as it does in VFP.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform