Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Date Fields when exact date is not known

Author  Topic 

cmr
Starting Member

1 Post

Posted - 2008-09-15 : 13:20:52
I was given an db to clean up. One table in the db is EmploymentHistory and contains a BeginDate field that is text. Sometimes users enter a date such as 1/2/1995, sometimes 1/1995 and sometimes just 1985. There are also entries like “Spring 1996” or “1998 off and on”. We need to be able to sort on the BeginDate field.

Is there a standard way to handle dates when users do not always know the exact date? Would breaking the BeginDate into 4 fields: Year, Month, Day and Notes be a good solution?.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-15 : 13:32:05
its always better to use datetime for storing date values as it helps the manipulation of date values easier. but if format is unoknown and user can even enter textual values, then its better to use varchar field. But remember that this will really make manipulations complex.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-15 : 13:32:18
The standard way is to use a datetime data type which would require the data be stored in a specific format.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-09-15 : 13:51:29
If you need to allow for the user to specify notes, then use a DateTime as mentioned, and just include an additional "Notes" column.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -