Solved

SQLDateTime overflow Delete issue?

Posted on 2009-07-02
10
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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