1

I am using SQL query to pull some student records from SQL database. I am getting the error Arithmetic overflow error converting expression to data type datetime. It looks like there is a column for student number which is char(15) type and throwing this error every time I put a letter in front of the student number (we have students with this case).

This works fine

Select * from StudentDataTable where StudentNumber = '123456789'

This throws the error

Select * from StudentDataTable where StudentNumber = 'A12345678'

Any help would be appreciated.

1
  • 4
    There is nothing in your queries shown that would even be trying to convert to a datetime. Please show the real query. We cannot help you when you oversimplify the problem. Commented Jun 6, 2011 at 14:43

1 Answer 1

0

SQL is converting the student number to an integer in the background, so your first examples works, but your second one won't. Check what data-type student number is, it should be numeric type, INT, BIGINT etc..

Also, you should be querying without the quotes for the student number, saves SQL converting

Select * from StudentDataTable where StudentNumber = 123456789

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.