且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在sql Server 2008中自动增加否?

更新时间:2023-02-07 14:23:17

从这里开始: http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server [ ^ ]


检查一下:自动生成AlphaNumeric ID in SQL Server表 [ ^ ]


阅读本文: HTTP://www.s qlteam.com/article/custom-auto-generated-sequences-with-sql-server [ ^ ]

专注于选项2(将其作为演示文稿问题)...

身份字段之间的标识符行之间的所有差异都是前面的E字母,以及您使用前导零填充固定长度的数字...

这只是一个视觉表示并没有真正增加数字的唯一性 - 这意味着如果你删除那些部分(E和前导零)你仍然有一个唯一的数字...

我的建议是去解决方案 - 使用标识列并在向最终用户呈现时对其进行格式化...
Read this article: http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server[^]
Concentrate on option 2 (Make it a presentation issue)...
All the difference between your line of identifiers between a identity field is the preceding E letter and the fact that you pad your number with leading zeroes to a fixed length...
That's only a visual representation and not really add to the uniqueness of the number - it means that if you remove those parts (E and leading zeroes) you still have a unique number...
My suggestion is to go with such a solution - use identity column and format it when presenting to end user...