List:General Discussion« Previous MessageNext Message »
From:Rolando Edwards Date:October 16 2006 6:49pm
Subject:Re: CREATE TABLE Inv_Id
View as plain text  
You may want to simulate autoincrementing
by means of Triggers

You may need to make ID a 12 character string first.

Then create a trigger something like this:

CREATE TRIGGER addingInv BEFORE INSERT ON Inv_Id
FOR EACH ROW SET @ID= '...'

You will have to also add what Gerald mentioned (casecode prefix,
a manufacturers id, a partnumber, and a check digit) to the table definition.

----- Original Message -----
From: Gerald L. Clark <gerald_clark@stripped>
To: Scott Hamm <linuxgold@stripped>
Cc: Mysql  <mysql@stripped>
Sent: Monday, October 16, 2006 2:31:47 PM GMT-0500 US/Eastern
Subject: Re: CREATE TABLE Inv_Id

Scott Hamm wrote:
> I'm trying to create a table as follows:
> 
> CREATE TABLE Inv_Id (
> ID INT(12) AUTO_INCREMENT PRIMARY KEY,
> MID INT NOT NULL,
> FOREIGN (MID) REFERENCES 'Model' (ID)
> );
> 
> How do I make ID to start out as '000000000001' for UPC barcode assignment?

UPC barcodes are not sequential numbers.
They are composed of a casecode prefix, a manufacturers id, a 
partnumber, and a check digit.

You cannot use an autoincrement number as a UPC.

-- 
Gerald L. Clark
Supplier Systems Corporation

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1


Thread
CREATE TABLE Inv_IdScott Hamm16 Oct
  • Re: CREATE TABLE Inv_IdGerald L. Clark16 Oct
    • Re: CREATE TABLE Inv_IdScott Hamm16 Oct
    • Re: CREATE TABLE Inv_IdRolando Edwards16 Oct
    • Re: CREATE TABLE Inv_IdGabriel PREDA16 Oct
      • Re: CREATE TABLE Inv_IdScott Hamm16 Oct
  • Re: CREATE TABLE Inv_IdDan Buettner16 Oct
  • Re: Re: CREATE TABLE Inv_IdMartijn Tonies19 Oct
    • RE: Re: CREATE TABLE Inv_IdJerry Schwartz19 Oct
Re: CREATE TABLE Inv_IdScott Hamm19 Oct
  • Re: Re: CREATE TABLE Inv_IdDan Buettner19 Oct