两个不同的id列 [英] two different id columns
本文介绍了两个不同的id列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在sql的同一个talbe中创建两个不同的id列。我试图通过从sql server管理工作室设置身份规范属性来创建..如果我只有一个id列,它工作正常..但是当我尝试创建另一个时,第一个的身份规范属性自动设置为false ...请帮我创建两个列...
解决方案
你不能
创建两个标识列在表格中
你可以做的是
创建一个标识列并添加计算列 [ ^ ]标识栏的值
SQL小提琴 [ ^ ]
你可以在sql中只创建一个identy列,但你可以用于排序目的或任何其他操作的另一列或一组列。
how to create two different id columns in the same talbe of sql. i am trying to create by setting identity specification property from sql server management studio.. it is working fine if i have only one id column.. but when i try to create another then the first one's "identity specification" property automatically sets to false... please help me to create both the columns...
解决方案
Youcannot
create two Identity Columns in a table
what you can do is
create an identity column and add a computed column[^] for the values of identity column
SQL Fiddle[^]
You can create only one identy column in sql, however you can use another columns or group of columns for sorting purpose or any other operations.
这篇关于两个不同的id列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文