473,378 Members | 1,578 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,378 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 8354
-----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?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.