Hannes Degenhart wrote: > > Dear all, > > we have a project where a statistic database is build up and the > statistics should be exported to Excel sheets. > > The database stores e. g. job opening dates and times. These > fields are > used more or less always to select data, for > - jobs in one month > - jobs between 10:00 hrs and 14:00 hrs a day > - ... > > What is the best data type to store the date/timestamps. > > I see three alternatives: > > 1. separate DATE and TIME fields > > 2. TIMESTAMP field > > 3. FIXED(18,12) field > > > Is there a hint which is the best concerning performance when > accessing > via an index? > > Thanks and > best regards > > Hannes
FIXED ? If I had to ask for those jobs done between 10 and 14, no matter which day, something with DIV and MOD would result, I assume. Does not sound easy, functions will avoid usage of indexes, not the best idea. TIMESTAMP ? same question as above. The if TIME(mytimestamp) between... will not use index, too. Not that nice. And functions (explicit or implicit) needed to be able to handle/qualify and which are used ooooften does at least do not increase the performance. Check for a specific month is no problem, no function needed. DATE + TIME ? Usually I do not like 2 columns if one could be used, but if conditions concerning the time-part are done often, if no microseconds are needed the I think, those two columns are better than one timestamp. And they together need less space compared to timestamp (because of the microseconds) Elke SAP Labs Berlin > -- > > Hannes Degenhart GPS - Gesellschaft zur Pruefung von Software mbH > Hoervelsinger Weg 54 D - 89081 Ulm - Germany > Pho. +49 731 96657 14 Fax. +49 731 96657 57 > mailto:[EMAIL PROTECTED] Web: > http://www.gps-ulm.de > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
