Monday, March 26, 2012

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"Alain Filiatrault" <alainf@.humaprise.com> wrote in message
news:45d95216.0312230604.328d0c8a@.posting.google.c om...
> 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

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

No comments:

Post a Comment