NevSoFly
asked on
need to convert string 030308 into smalldatetime
when using the below query I get the error 'Arithmetic overflow error converting expression to data type smalldatetime.'
UPDATE tblCourseHistory
SET Starting_Date = RIGHT(Course_Code, 6)
WHERE (Starting_Date IS NULL)
Starting_Date has a datatype of smalldatetime
Course_Code has a dataype of nvarchar
UPDATE tblCourseHistory
SET Starting_Date = RIGHT(Course_Code, 6)
WHERE (Starting_Date IS NULL)
Starting_Date has a datatype of smalldatetime
Course_Code has a dataype of nvarchar
The other thing that may be going on is if Course_Code does not have at leas 6 characters. You may want to check your string length before making the assignment.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
Starting_Date = CAST(RIGHT(Course_Code,6) AS SMALLDATETIME)