没有主键的自动增量字段 [英] Auto Increment Field without Primary-KEY

查看:93
本文介绍了没有主键的自动增量字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(SQL Server-2008的)我的表字段如下.
//------------------------------------------------
item_id(这应该是int-AutoIncrement.我该如何实现)
Item_Name(主键)
Item_Brand(主键)
Item_ModelNo(primary-Key)

My table fields(of SQL server-2008) are as follows.
//------------------------------------------------
item_id (This should be an int-AutoIncrement. How can I achive this)
Item_Name(primary-Key)
Item_Brand(primary-Key)
Item_ModelNo(primary-Key)

推荐答案

很容易:D
在列属性"的身份规范"中将其身份"设置为是"(如果使用SQL Server Management Studio)



如果使用查询,请使用以下内容:

Very easy :D
Set its Is Identity to Yes in Indentity Specification in Column Properties (if using SQL server Management studio)

or

if using query use below:

P_Id int NOT NULL AUTO_INCREMENT



查看更多信息@ http://www.w3schools.com/sql/sql_autoincrement.asp [ ^ ]



See more info @ http://www.w3schools.com/sql/sql_autoincrement.asp[^]


这篇关于没有主键的自动增量字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆