Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在数据库中有表,主键是“TID”列,我想将其设置为 AUTOINCREMENT,但我不能,因为“身份规范”已关闭!
见这张图片: http ://www.rofof.com/img2/6xsbuy6.gif
我该怎么做?
谢谢!
您需要将其设为int列或其他数字类型,而不是nchar列。我怀疑nchar(10)您的其他列的类型也是错误的:您可能想要nvarchar名称字段的列,并且您需要为 10 个多一点的字符留出空间。
int
nchar
nchar(10)
nvarchar
您正在尝试自己设置 ID 列的值。当您使用自动增量列时,您根本不会将 ID 列放在插入语句中。
使用支持自动增量的类型,例如int或bigint。