 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tumurbaatar S. Guest
|
Posted: Tue Oct 14, 2003 9:56 am Post subject: Year only date field |
|
|
What field type I should to use if a field contains
only year values: date column or number? And why?
|
|
| Back to top |
|
 |
Jayme Jeffman Filho Guest
|
Posted: Tue Oct 14, 2003 5:13 pm Post subject: Re: Year only date field |
|
|
Hi Tumurbaatar,
It depends on how the database system you are using stores the date and
number types, choose the one which uses less disk space.
HTH
Jayme.
"Tumurbaatar S." <tumurbaatar (AT) datacom (DOT) mn> wrote
| Quote: | What field type I should to use if a field contains
only year values: date column or number? And why?
|
|
|
| Back to top |
|
 |
Dwayne Guest
|
Posted: Wed Oct 15, 2003 5:26 pm Post subject: Re: Year only date field |
|
|
Tumur>>What field type I should to use if a field contains
only year values: date column or number? And why?<<
That really depends upon the way the data is going to be used and
the programmer.
I have used int, as well as char. Since a 16bit integer is good up to
32000+ for it handles a 4 digit
year quite well. A char string will work well too. The biggest thing I
would say, what are you going to do with it? compare? sort? manipulate?.
It is easy to compare integers and quite fast...
if (int a)<(intb) then....
little slower to do
if(strncmpi(a, b,strlen(a(or)b))==0) then....(because I do not know if
you are saving 4 digit years or 2).
Maybe some others will have a more percise answer.
Dwayne
|
|
| 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
|
|