Monday, March 19, 2012

Date handling in SQL Server

I need to make a decision regarding date handling to continue as is or reopen
and modify completed development, if it is felt that current approach was not
he best.
All development to date has been done with the use of two default dates.
There is one default date 01/01/1800 used for all date fields except
term_date. For term_date a forever date of 01/01/2900 is used. All programs
identify terminated records as term_date less than 01/01/2900.
My questions are:
Why arenâ't we using Null values
Why two default dates instead of just one.
What standard does your company use? What is the most common approach being
used/ Any input you can provide will help us decide our forward direction.
Thanks.In my opinion, when a data is unavailable/unknown, you should set it to
NULL, instead of hardcoding your applications to look for certain very old
or very futuristic dates.
You could use new columns to indicate the status of rows, instead of using
hardcoded date values.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"James Juno" <JamesJuno@.discussions.microsoft.com> wrote in message
news:7F85F760-6C09-4579-98FC-D3EC1FD9FE73@.microsoft.com...
I need to make a decision regarding date handling to continue as is or
reopen
and modify completed development, if it is felt that current approach was
not
he best.
All development to date has been done with the use of two default dates.
There is one default date 01/01/1800 used for all date fields except
term_date. For term_date a forever date of 01/01/2900 is used. All
programs
identify terminated records as term_date less than 01/01/2900.
My questions are:
Why aren't we using Null values
Why two default dates instead of just one.
What standard does your company use? What is the most common approach being
used/ Any input you can provide will help us decide our forward direction.
Thanks.|||Thanks for your suggestion. How would you determine terminated records?
James
"Narayana Vyas Kondreddi" wrote:
> In my opinion, when a data is unavailable/unknown, you should set it to
> NULL, instead of hardcoding your applications to look for certain very old
> or very futuristic dates.
> You could use new columns to indicate the status of rows, instead of using
> hardcoded date values.
> --
> HTH,
> Vyas, MVP (SQL Server)
> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>
> "James Juno" <JamesJuno@.discussions.microsoft.com> wrote in message
> news:7F85F760-6C09-4579-98FC-D3EC1FD9FE73@.microsoft.com...
> I need to make a decision regarding date handling to continue as is or
> reopen
> and modify completed development, if it is felt that current approach was
> not
> he best.
> All development to date has been done with the use of two default dates.
> There is one default date 01/01/1800 used for all date fields except
> term_date. For term_date a forever date of 01/01/2900 is used. All
> programs
> identify terminated records as term_date less than 01/01/2900.
> My questions are:
> Why aren't we using Null values
> Why two default dates instead of just one.
> What standard does your company use? What is the most common approach being
> used/ Any input you can provide will help us decide our forward direction.
> Thanks.
>
>|||I agree with Vyas... However if some rows have a valid termination date and
others do not,,, only place a date value when it is know, and do not default
to some max value...
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"James Juno" <JamesJuno@.discussions.microsoft.com> wrote in message
news:B52B23B0-6BCA-4333-A15F-FFA7DC9347D0@.microsoft.com...
> Thanks for your suggestion. How would you determine terminated records?
> James
> "Narayana Vyas Kondreddi" wrote:
>> In my opinion, when a data is unavailable/unknown, you should set it to
>> NULL, instead of hardcoding your applications to look for certain very
>> old
>> or very futuristic dates.
>> You could use new columns to indicate the status of rows, instead of
>> using
>> hardcoded date values.
>> --
>> HTH,
>> Vyas, MVP (SQL Server)
>> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>>
>> "James Juno" <JamesJuno@.discussions.microsoft.com> wrote in message
>> news:7F85F760-6C09-4579-98FC-D3EC1FD9FE73@.microsoft.com...
>> I need to make a decision regarding date handling to continue as is or
>> reopen
>> and modify completed development, if it is felt that current approach was
>> not
>> he best.
>> All development to date has been done with the use of two default dates.
>> There is one default date 01/01/1800 used for all date fields except
>> term_date. For term_date a forever date of 01/01/2900 is used. All
>> programs
>> identify terminated records as term_date less than 01/01/2900.
>> My questions are:
>> Why aren't we using Null values
>> Why two default dates instead of just one.
>> What standard does your company use? What is the most common approach
>> being
>> used/ Any input you can provide will help us decide our forward
>> direction.
>> Thanks.
>>

No comments:

Post a Comment