SQL Server UInt64或十进制(20,0)/十进制(28,0) [英] SQL Server UInt64 or decimal(20,0)/decimal(28,0)

查看:245
本文介绍了SQL Server UInt64或十进制(20,0)/十进制(28,0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将社交网络ID存储在数据库中。支持解决方案的2个社交网络中的一个使用无符号64位用户标识符。

I need to store Social network ID in database. One of 2 supported social network for solution use unsigned 64-bit user identifier.

现在我使用小数(28,0)。这是正确的吗?

Now I'm using decimal(28,0). Is it correct?

例如我需要存储ID ='18445016066725229233'

For example I need to store ID='18445016066725229233'

可能支持System.UInt64吗?

May be System.UInt64 is supported?

推荐答案

SQL Server不支持无符号整数作为数据类型,例如  BigInt映射到Int64,而不是UInt64,所以如果你需要处理你有一些选择,一个是使用十进制,或者你可以简单地将它存储在二进制(n)列中。取决于您需要的
和应用程序使用情况。如果它仅用作密钥,我个人会使用二进制(n),但这假设您只对值执行相等比较而不进行算术运算。 

SQL Server does not support unsigned integers as a data type, for example BigInt maps to Int64, not to UInt64, so if you need to deal with this you have some options, one is to use decimal, or you can simple store it in a binary(n) column. Depends on you needs and application usage. If it is only used as a key, personally I would go with binary(n), but this assumes you are only performing equality comparison and no arithmetical operations on the value. 

这篇关于SQL Server UInt64或十进制(20,0)/十进制(28,0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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