Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arithmetic overflow error converting expression to data type datetime.

Status
Not open for further replies.

luvmy2Js

IS-IT--Management
Sep 1, 2010
43
US
Could someone please help me figure out how to convert the below data:

'19731214' is how the date is printed from the database.

I have tried:

1. CONVERT(varchar, CONVERT(datetime, CONVERT(nvarchar, DecryptByKey(a.[Birth Day])), 101), 101)

But it returns the "Arithmetic overflow..." error.

Any suggestions would be greatly appreciated.

Thanks!!
 
What you get from:
Code:
SELECT DecryptByKey(a.[Birth Day])
?


Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
All data is encrypted in the database so it has to be decrypted when extracting it out..
 
Try setting the length of VARCHAR and NVARCHAR.

For example; VARCHAR(8).

The other thing to do is check what your DATEFORMAT setting is. You are trying to read yyyymmdd and change it to mm/dd/yy. If your DATEFORMAT isn't YMD then it will read the value incorrectly.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top