This sounds like a failure to design data correctly. Let's start with
the basics; did you reallllllly to put that "sp_" on the name? That is
a proprietary and special meaning. While it might be deliberate, it is
usually an error 99% of the time.
I know that the "tbl-" prefix is an error; while gay marriages are an
issue, no state has yet allowed people to marry furniture :) [Read
ISO-11179 for the right way to name data elements -- you name things for
what they are LOGICALLY in the data model, never for where or how they
are stored in the PHYSICAL database]
[quoted text, click to view] >> The length of the @Barcode variable is 10 characters and it is a
nchar type variable so I don't understand the 'int column' overflow
issue. <<
You can easily overflow an integer with ten digits; look up the max
limits of the datatypes in BOL. Do not use INTEGER for this data
element.
But it looks like you left out a CHECK() constraint on at least one
table -- wish we had some DDL to look at, so we don't have to guess. I
am also willing to bet that the barcode is a fixed length column and
should be declared something like this
barcode CHAR(10) -- fixed length
DEFAULT '0000000000' -- assumption
NOT NULL -- assumption
CHECK (barcode LIKE
'[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' -- requirement
While I guess it is possible, variable length barcodes would be a bitch
to check digit and I have never seen one before.
--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.
*** Sent via Developersdex
http://www.developersdex.com ***