GUID类型在数据库中 [英] GUID type in database

查看:112
本文介绍了GUID类型在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GUID不是数据库中的官方数据类型。在我们现有的SQL Server设计中,Uniqueidentifier类型用于GUID值。现在我们切换到Sybase数据库。我们应该使用varchar(36)来替换Uniqueidentifier类型吗?



我仍然困惑于GUID。我被告知GUID是16字节长,但其字符串的长度为36个字符。

解决方案

GUID实际上是一个整数类型 - 它是一个128位整数(16字节)。

它通常表示为36个字符的字符串,但实际值是一个128位的整数值。


GUID is not an official data type in database. In our existing SQL Server design, the Uniqueidentifier type is used for GUID value. Now we are switching to Sybase database. Should we use varchar(36) to replace that Uniqueidentifier type?

I am still confused by GUID. I was told GUID is 16 bytes long but its character string is 36 characters in length. I must missed something.

解决方案

A GUID is actually an integer type - it's a 128 bit integer (16 bytes).

It's often represented as a string of 36 characters - but the actual value is a 128bit integer value.

这篇关于GUID类型在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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