using a constant field

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fred

    #1

    using a constant field

    Hi Planet!

    I have created a table (see test script below)

    I have an Id field that will contains numerical values.
    For reason behond my control This field has to have a
    constant hard coded letter V in front of it.

    V4789
    V0023
    ect...

    Is there a way know to man kind to do this and
    avoid storing 100 000 letter V for nothing...
    And maybe keep a INT type rather than it becoming
    VARCHAR or CHAR.

    thanks for your help.


    CREATE DATABASE JK_PROD;
    USE JK_PROD;

    CREATE TABLE VOUCHERS (
    Id INT(8),
    Marketing_Code VARCHAR(15),
    Date_Created DATETIME,
    Date_Used DATETIME,
    Account_Nb VARCHAR(10) NOT NULL,

    PRIMARY KEY(Id)
    );

    CREATE UNIQUE INDEX IDX_VOUCHERS ON VOUCHERS (Id);


    INSERT INTO VOUCHERS VALUES
    ('','mrk code 1','2004-01-01','2004-01-02','AC01');
    INSERT INTO VOUCHERS VALUES
    ('','mrk code 2','2004-01-01','2004-01-02','AC02');
    INSERT INTO VOUCHERS VALUES
    ('','mrk code 3','2004-01-01','2004-01-02','AC03');
Working...