RE: how to insert into a table that the only column is an identit y field?

RE: how to insert into a table that the only column is an identit y field?

 

  

Try selecting @@identity.An Set identity_insert table_name ON and then
insert the row as @@identity+1.

-----Original Message-----
From: [Email Address Removed] [mailto:[Email Address Removed] Wednesday, July 03, 2002 3:24 PM
To: Fang, Elaine; [Email Address Removed] RE: how to insert into a table that the only column is an
identity field?


Would it be possible to change the field to a user defined int and then just
create a query that chooses the max and ads one when performing the insert?

- BILL -

-----Original Message-----
From: Fang, Elaine [mailto:Elaine.[Email Address Removed] Wednesday, July 03, 2002 3:18 PM
To: [Email Address Removed] how to insert into a table that the only column is an identity
field?


Hi list,

I have a table called EmailGroup and the only column in that table is
EmailGroupID which is defined as an identity field. How can I insert a
record to that table?

Obviously, I don't want to set identity_insert table_name ON since I want
the system to generate the identity column value for me.

Any idea?

Thanks and have a good 4th of July!

Elaine









---------------------------------------------------------------------
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page