Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    21

    Unanswered: Automatically increasing field definition by SQL

    How can I create/define a field so it'll be of the automatically increasing type with a SQL sentence? If it must be done during table creation, that's cool too.

    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Create table a
    (
    name varchar2(100)
    );

    Alter table a
    modify name varchar2(200);
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Are you asking how to create a column that will increase in value, or increase in size? If you are looking to create something analagous to Oracle's rowid, the syntax is different for each database engine, so you'll have to tell us which engine you are using for us to give you one answer.

    -PatP

  4. #4
    Join Date
    Mar 2004
    Posts
    21
    It's on ACCESS.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Originally posted by anat_sher
    It's on ACCESS.
    That's helpful, but are you looking for an MS-Access AUTONUMBER column, or a TEXT column that will increase in length each time you do something?

    -PatP

  6. #6
    Join Date
    Mar 2004
    Posts
    21
    AUTONUMBER please..

    It's not on ACCESS really, it's on a SQL server. But I figured it's about he same. No?

  7. #7
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    create table tableA
    (
    id INTEGER IDENTITY(1, 1)
    ...
    )
    Last edited by r123456; 03-30-04 at 09:40.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

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