Link to home
Start Free TrialLog in
Avatar of NJordan72
NJordan72

asked on

SQL Error "String or binary data would be truncated"

I was inserting some stuff into a database today and got the following error "String or binary data would be truncated."  I hadn't seen it before.  I looked at my code and coudln't find anything wrong.  I then retried the INSERT with the EXACT same data, and it worked fine.  Have any idea what the error is or where it comes from?
Avatar of daniel_c
daniel_c

Yupe, the length of the data you insert (usually string) exceeds the length of the field.

For example:
tabel: PRODUCT
field: productname varchar(10)


You do this:
INSERT INTO Product('1234567890123')

It will raise the error.
If you tried the insert with the same data then it implies that it it is not just the values that are too long.

How were you doing the insert that fails.
I suspect your test was via query analyser and there is something in the interface that failed previously.
Avatar of NJordan72

ASKER

I was doing the insert via an Activer Server Page.
Okay, post your ASP code, then let's see it.
ASKER CERTIFIED SOLUTION
Avatar of ibro
ibro

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial