Results 1 to 6 of 6

Thread: Default values with create table command

  1. #1
    Join Date
    Jul 2003
    Posts
    3

    Default values with create table command

    Hi,

    am still new at this SQL jazz. Just wanted to know how I would put default values into fields when using the CREATE TABLE command. here's the very simple code, I need to make the default 'COLOUR' 'blue', any ideas???

    CREATE TABLE MODEL
    (COM_MODEL CHAR(5) PRIMARY KEY,
    COLOUR CHAR(10),
    COST CURRENCY NOT NULL);


    BTW, this is being done in MS ACCESS.

    thanks in advance

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    I dont think you can do that with DDL statement.

  3. #3
    Join Date
    Jul 2003
    Location
    hyderabad, India
    Posts
    4
    Hi,

    This is possible.

    CREATE TABLE MODEL
    (
    COM_MODEL CHAR(5) PRIMARY KEY,
    COLOUR CHAR(10) default ('BLUE'),
    COST CURRENCY NOT NULL
    );

    Thanks

    M. Antony Gubert.

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Syntax error in create table statement.

  5. #5
    Join Date
    Jul 2003
    Location
    hyderabad, India
    Posts
    4

    Syntax

    Hi,

    The above syntax is for Oracle database.
    Not for MS Access.

    Thanks

    M. Antony Gubert.

  6. #6
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •