两个不同的id列

编程入门 行业动态 更新时间:2024-10-10 04:21:51
本文介绍了两个不同的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...

解决方案

You cannot 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列

本文发布于:2023-05-31 10:30:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两个   id

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!