in

ASP.NET Weblogs

Dave Burke - A freelance .NET Developer specializing in Online Communities

A freelance .NET Developer

Now a SQL DateTime man (no more SmallDateTime for me!)

I mentioned the other night some dealings with using nullable value types in a SQL DateTime datatype.  I decided to go with my own date code for a condition, then null the value in the DL.  In this case I used '1/1/1869.' 

But then I get the runtime:

SqlDbType.SmallDateTime overflow. Value '1/1/1869 12:00:00 AM' is out of range. Must be between 1/1/1900 12:00:00 AM and 6/6/2079 11:59:59 PM.

I've used SmallDateTime out of habit for years in setting up SQL field datatypes.  No more.  That's a pretty small time span when you think about it--not that we typically have a lot of use for 19th century dates, and I'm pretty sure I'll be dead in 2079 so I won't have to worry about updating my code, but still...

Published Mar 30 2004, 10:22 PM by daveburke
Filed under:

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add