EXEC sp_help 'tblOrder'
say about the datatype, and size, of the
You aren't specifying a schema (e.g.
UPDATE dbo.tblOrder) so there is a risk that there are two tables called
tblOrder - one in the schema which is the default when you are logged on and, say, another for the
dbo schema. (I recommend that you always specify a schema a) to avoid that risk and b) because it saves time as SQL does not have to check IF there IS an object in the default schema with that name ... discovering there isn't ... and then trying
Its also possible - despite the object name prefix ... - that your
tblOrder is actually mapping a VIEW and that is mapping
OrderID to a column that has a 10 character limit.
Or it might be mapping to a
SYNONYM bit of a long shot as I expect they are rare!)
sp_help will clarify if it is any of those causes.
Other possibility is that something, somewhere, is using a
VARCHAR definition with no size defined, and SQL is providing a default size (using
VARCHAR without a size is an accident waiting to happen I'm afraid - in some situations SQL will even default that to Size=1 )
Lastly, maybe there is a TRIGGER on 'tblOrder' which is truncating the value (perhaps because the trigger is processing the data in some way that uses @Variables that are defined too narrow)
EXEC sp_depends 'tblOrder'
will tell you if there is a trigger (see the
TYPE column in the results)
I don't think that is it because you error message says
Procedure onupd, Line 12 and I would have expected it to say "Trigger" in that message instead.
Do you mean "with no warning" or "With no truncation" ?