auto increment option
I need开发者_开发技巧 to set the auto increment option for a particular column in a row of a database to be true so that the value increments each time a new row is inserted.
How do i do that?
You can use IDENTITY property in TSQL
CREATE TABLE new_employees
(
id_num int IDENTITY(1,1),
fname varchar (20),
minit char(1),
lname varchar(30)
);
Try this
The database column itself must be specified to be an identity...
- Using SQL Management Studio, open the table
- Expand the
Identity Specification
tree - Alter the value of
Is Identity
toYes
Identity Increment
will now be1
, change it if necessary
精彩评论