开发者

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 to Yes
  • Identity Increment will now be 1, change it if necessary
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜