Saturday, February 25, 2012

Dates overlow

Dear All,
When I enter a date with the year before 1950, it is rejected with an
"overflow" message.
I'm building an application that uses dates that ranges from 1200 till 2004.
So, does any body know how to solve this problem?
Regards,
Mohamed El Wakil
Teaching Assistant
Information Systems Department,
Faculty of Computers and Information,
Cairo University - Cairo
http://mohamedelwakil.tripod.com
Please, reply to mohamed.elwakil@.omeldonia.com
SQL Server accepts date from 1753 to 9999 for the datetime datatype. If you need to go out of this
span, you need to use some other representation. A string representation is one option. A number of
integer columns (one for each element) is another. One integer column counting seconds from a
certain reference date is yet another option.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mohamed Medhat" <mohamed.elwakil @. omeldonia.com> wrote in message
news:3C5F569B-9C67-421C-802E-24D14B301044@.microsoft.com...
> Dear All,
> When I enter a date with the year before 1950, it is rejected with an
> "overflow" message.
> I'm building an application that uses dates that ranges from 1200 till 2004.
> So, does any body know how to solve this problem?
> Regards,
> Mohamed El Wakil
> Teaching Assistant
> Information Systems Department,
> Faculty of Computers and Information,
> Cairo University - Cairo
> http://mohamedelwakil.tripod.com
>
> Please, reply to mohamed.elwakil@.omeldonia.com
>
|||The exact "overflow" error would be helpful. Does it come from SQL Server
or from whatever application you are using to enter the date?
Are you using two digits for the year? I recommend that you use more...
There are easier ways to enter dates than typing them all in...a WHILE loop
might be easier!
You may have some problems entering dates earlier than 1753.
From Books Online:
datetime and smalldatetime
Date and time data types for representing date and time of day.
datetime
Date and time data from January 1, 1753 through December 31, 9999, to an
accuracy of one three-hundredth of a second (equivalent to 3.33 milliseconds
or 0.00333 seconds). Values are rounded to increments of .000, .003, or .007
seconds, as shown in the table.
Keith
"Mohamed Medhat" <mohamed.elwakil @. omeldonia.com> wrote in message
news:3C5F569B-9C67-421C-802E-24D14B301044@.microsoft.com...
> Dear All,
> When I enter a date with the year before 1950, it is rejected with an
> "overflow" message.
> I'm building an application that uses dates that ranges from 1200 till
2004.
> So, does any body know how to solve this problem?
> Regards,
> Mohamed El Wakil
> Teaching Assistant
> Information Systems Department,
> Faculty of Computers and Information,
> Cairo University - Cairo
> http://mohamedelwakil.tripod.com
>
> Please, reply to mohamed.elwakil@.omeldonia.com
>
|||Date outside the range 1753-9999 is not accepted at datetime type. Look for
datetime and smalldatetime in BOL for more detail.
You can come up with your own definition, not as datetime, but such as a
char column, to accommodate your needs.
Quentin
"Mohamed Medhat" <mohamed.elwakil @. omeldonia.com> wrote in message
news:3C5F569B-9C67-421C-802E-24D14B301044@.microsoft.com...
> Dear All,
> When I enter a date with the year before 1950, it is rejected with an
> "overflow" message.
> I'm building an application that uses dates that ranges from 1200 till
2004.
> So, does any body know how to solve this problem?
> Regards,
> Mohamed El Wakil
> Teaching Assistant
> Information Systems Department,
> Faculty of Computers and Information,
> Cairo University - Cairo
> http://mohamedelwakil.tripod.com
>
> Please, reply to mohamed.elwakil@.omeldonia.com
>

No comments:

Post a Comment