472,333 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

Numeric overflow in [tinyint] field

Hi,

In Query Analyzer:
update tblUserProcess
set usercode = 1002

Error:
Arithmetic overflow error for data type tinyint, value = 1002.
The statement has been terminated.

In VBA/Access:

intOptions = 512
pstrQuerySQL = "UPDATE ..."

CurrentDb.Execute pstrQuerySQL, intOptions

Result: no errors, insert value 223 (??)

Why?

Thanks, Eugene
Nov 13 '05 #1
2 8268
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The TINYINT data type holds numbers 0 thru 255. Trying to put 1002 into
a column w/ that data type causes the overflow (imagine trying to pour
40 gallons of water into a 20 gallon container - it would overflow).

Why the dbSeeChanges (512) option suppresses the error - I don't know!

To be able to enter 1002 into your usercode column, try changing the
column's data type to SMALLINT.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQf/qO4echKqOuFEgEQJx6wCfTtmFoimgItOtNBHO2fWhYiJloPQAo IcZ
bLQQBUkLLKVBxIcux6Gc8f7o
=+Ha1
-----END PGP SIGNATURE-----
Eugene wrote:
Hi,

In Query Analyzer:
update tblUserProcess
set usercode = 1002

Error:
Arithmetic overflow error for data type tinyint, value = 1002.
The statement has been terminated.

In VBA/Access:

intOptions = 512
pstrQuerySQL = "UPDATE ..."

CurrentDb.Execute pstrQuerySQL, intOptions

Result: no errors, insert value 223 (??)

Why?

Thanks, Eugene

Nov 13 '05 #2
MGFoster wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The TINYINT data type holds numbers 0 thru 255. Trying to put 1002 into
a column w/ that data type causes the overflow (imagine trying to pour
40 gallons of water into a 20 gallon container - it would overflow).

Why the dbSeeChanges (512) option suppresses the error - I don't know!


Because there's no dbFailOnError, use 640 instead of 512. Better still,
the OP should make the code a bit more self documenting:

CurrentDb.Execute pstrQuerySQL, dbSeeChanges + dbFailOnError

Most people would have to dig around to find out what slapping 512 onto
the end of an Execute method would do.

The value 233 probably comes from some sort of wrapping but I would have
expected nearer to 237 to be inserted.

--
This sig left intentionally blank
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DiggidyMack69 | last post by:
Hello folks, I have a servlet in a Java web app that accesses an oracle table with a column that is NUMBER(12) When I put an integer into it of 10...
6
by: Eugene | last post by:
Hi, I have a field: usercode In Query Analyzer: UPDATE tblUserProcess SET usercode = 1002 Result: Error "Arithmetic overflow error for...
2
by: phillip.s.powell | last post by:
For some bizarre reason, each time I insert or update a row in my table `image`, the field value for "image_width" is fixed at 127, no matter what...
0
by: Bob | last post by:
I hope somebody can help. I'm linking to an excel spreadsheet with several fields that come across as double. I can query the linked table fine,...
4
by: Thiyagusathya | last post by:
Hi., Please help me for java script validation for text and numeric field.
21
by: Geoff Cox | last post by:
Hello I have a TINYINT(1) field, group1, in a mysql data base and the value is 1 but php if ($row == "1") { does not work. What should I...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.