Solved

SQLDateTime overflow Delete issue?

Posted on 2009-07-02
10
233 Views
Last Modified: 2012-05-07
I receive the error: "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM" when attempting to delete a record in my backend sql server 2005 database??
0
Comment
Question by:Shepwedd
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24763616
datetime wont support upto 9999 use value upto 2049-12-31
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24763668
sorry , mymistake it supports   January 1, 1753, through December 31, 9999..  seems like your database constain values that are out of range
0
 
LVL 41

Expert Comment

by:ralmada
ID: 24763678
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 200 total points
ID: 24763684
SELECT *
FROM urTable
WHERE  ISDATE(urDateColumn) = 0
0
 

Author Comment

by:Shepwedd
ID: 24764121
aneeshattingal,

Do you want me to run your query on my table?
0
 

Author Comment

by:Shepwedd
ID: 24764178
No results are returned when I run your query.

I am setting the time value as well as the date value of my column if this causes an issue?
0
 

Author Comment

by:Shepwedd
ID: 24764200
...and the time is being set in 24hr, i.e. a typical value that I'm wanting to delete is 15/07/2009 15:00:00. But obviously it's not being deleted as I get the error.
0
 
LVL 41

Assisted Solution

by:ralmada
ralmada earned 150 total points
ID: 24764258
The problem is not in your table but in the code you're passing from ASP. Have you checked the link I've suggested above?
 
http://forums.asp.net/t/1134244.aspx 
Here's another one:
http://p2p.wrox.com/asp-net-3-5-basics/73673-sqldatetime-overflow.html 
0
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 150 total points
ID: 24764386
What is the datatype of that column either datetime or smalldatetime?

smalldatetime wont support that value. It supports till 06-06-2079 only.

aneesh,
    SELECT *
FROM urTable
WHERE  ISDATE(urDateColumn) = 0

This will work fine for both datetime and smalldatetime.

Shepwedd,
   Can you kindly confirm this one
0
 
LVL 41

Expert Comment

by:ralmada
ID: 24764645
 

I still think the problem is not in the table. If I understood correctly he's trying to delete a record, so the record is already in the table and is valid date. i.e. doing a select with ISDATE will not return any records because the table contains valid dates.

I feel the problem is with the parameter being received from ASP. Probably the asker is sending a '01/01/0001' date which is not supported in SQL. Again, have a look at the links I've suggested.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net VB.net Highlight html text in yellow in body of email 5 23
ASP.NET MVC 2 31
https://github.com/willowsystems/jSignature 11 50
Email Notifications for SQL 2005 9 28
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question