473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 8356
-----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 digits or larger I get a numeric overflow error....
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 data type tinyint, value = 1002. The statement has...
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 value I use! Here is the schema: CREATE...
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, but when I make a form with the query as the...
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 be writing here?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.