如何确保最大主值永远不会耗尽 [英] How to ensure that the max primary value is never exhausted

查看:145
本文介绍了如何确保最大主值永远不会耗尽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft sql server中int数据类型的最大值是
-2 ^ 63(-9,223,372,036,854,775,808)到2 ^ 63-1(9,223,372,036,854,775,807)。是否存在没有最大值的数据类型?我需要定义该数据类型的主键。我认为一个解决方案ID为GUID但我不知道如何获取特定的GUID,如果它是EmployeeId作为主键。怎么办?

max value for int data type in Microsoft sql server is
-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807). is there any data type for which there is no max value ? i need to define the primary key of that data type.i think one solution id GUID but i do not know how to get the particular GUID say if it EmployeeId as primary key .What to do?

推荐答案

不要因为无用的想法而耗尽你的大脑!员工是人,不是吗?地球上有多少人?该数据类型的最大数量超过1000万倍。
Do not exhaust your brain for useless thoughts! An employee is a human being, isn't he? How many people are there on earth? The max number of that datatype is more than a 1000million times bigger.


在这里你可能得不到解决方案,但肯定你会得到一些想法..



#Here [ ^ ]
here you may not get the solution, but definately you'll get some thoughts..

#Here[^]


有几个< a href =http://msdn.microsoft.com/en-us/library/ms710150%28v=vs.85%29.aspx>数据类型 [ ^ ]并且每种类型都有其局限性(在简单的方式)。

我建议使用GUID,如下所述: NEWSEQUENTIALID [ ^ ]在这里: UNIQUEIDNETIFIER [ ^ 。请阅读所有笔记。



样本 [ ^ ]
There is several data types[^] and each type has its limitation (in a simple manner).
I'd suggest to use GUID, as is described here: NEWSEQUENTIALID[^] and here: UNIQUEIDNETIFIER[^]. Please, read all notes.

Sample[^]


这篇关于如何确保最大主值永远不会耗尽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆