Alter Command

  • please someone show me how to add an autonumber fied for an existing table from access query (not from table design).  I use this command, but it keeps give me error:

    ALTER TABLE tbl_open_order ADD COLUMN rownum AutoNumber (long integer)

    Thanks a lot

    Maijoe

    an

  • ALTER TABLE tbl_open_order

    ADD rownum int NULL

    or

    ALTER TABLE tbl_open_order

    ADD rownum bigint NULL

    Depending on the number of bytes you need for the integer. NULL is necessary if you have rows until you populate the column.

    K. Brian Kelley
    @kbriankelley

  • try:

    ALTER TABLE tbl_open_order

    ADD rownum  AUTOINCREMENT (1,1)

    OR

    ALTER TABLE tbl_open_order

    ADD rownum IDENTITY (1,1)

    OR

    ALTER TABLE tbl_open_order

    ADD rownum Counter (1,1)


    * Noel

  • Oops, missed the autonumber part. Doh! Thanks, Noeld, for catching that. For SQL Server, use the IDENTITY(1,1) to autonumber.

    K. Brian Kelley
    @kbriankelley

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply