将标识添加到现有表 [英] adding identity to existing table
本文介绍了将标识添加到现有表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i想要将一个带有标识的新列Student_ID添加到一个现有的表中,该表中有一些带有一些记录的student_name列。
我想计算总数没有student_name并希望将其作为Student_ID的身份种子。
所以我尝试使用这样的子查询...
hi all,
i want to add a new column Student_ID with identity to an existing table having student_name column present with some records.
I want to count total no of student_name and want to make it as seed of identity for Student_ID.
So i am trying with sub query like this...
alter table morningbatch
add sid int identity((select count (sname) from morningbatch),1)
plz help
plz help
推荐答案
阅读如何将一个标识列添加到包含数据的表中? [ ^ ] br />
-KR
Read this How to add an identity column to a table with data?[^]
-KR
这篇关于将标识添加到现有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文