PsycheBNP
asked on
Cannot delete row due to: out-of-range smalldatetime value
I'm having a problem with mssql. I accidentally inserted a value into a smalldatetime field using getdate(). When I try to delete the row using queries like
delete from tborders where nOrderID=1
or
delete from tborders where Convert(Varchar,dteOrderDa te,103) = '22/03/2006'
It gives me the error;
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
Is there another delete statement I could use to get rid of this row?
Thanks in advance for your help.
delete from tborders where nOrderID=1
or
delete from tborders where Convert(Varchar,dteOrderDa
It gives me the error;
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
Is there another delete statement I could use to get rid of this row?
Thanks in advance for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the fast reply angelIII, unfortunately your query returned the same error.
ASKER
That did the trick aneeshattingal, thank you very much.
where dteOrderDate >= convert(smalldatetime, '22/03/2006', 103)
AND dteOrderDate < dateadd(day, 1, convert(smalldatetime, '22/03/2006', 103) )