How to insert a row in a table with 1 identity column

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

    #1

    How to insert a row in a table with 1 identity column

    HI,

    I have an SQL Server table with only 1 column. That column is an
    identity column. How can I insert a row in this table using SQL
    syntax?

    I tried insert
    into T_tableName () values ()
    and a few other options, but I can't seem to get it to insert.

    Thanks

    Alain
  • John Gilson

    #2
    Re: How to insert a row in a table with 1 identity column

    "Alain Filiatrault" <alainf@humapri se.com> wrote in message
    news:45d95216.0 312230604.328d0 c8a@posting.goo gle.com...[color=blue]
    > HI,
    >
    > I have an SQL Server table with only 1 column. That column is an
    > identity column. How can I insert a row in this table using SQL
    > syntax?
    >
    > I tried insert
    > into T_tableName () values ()
    > and a few other options, but I can't seem to get it to insert.
    >
    > Thanks
    >
    > Alain[/color]

    CREATE TABLE T
    (
    col INT IDENTITY NOT NULL PRIMARY KEY
    )

    INSERT INTO T
    DEFAULT VALUES
    INSERT INTO T
    DEFAULT VALUES

    SELECT col FROM T

    col
    1
    2

    Regards,
    jag


    Comment

    Working...