GUID: varchar(36) versus uniqueidentifier

后端 未结 5 898
北恋
北恋 2021-02-19 01:15

I\'m working with a legacy database that stores GUID values as a varchar(36) data type:

CREATE TABLE T_Rows (
    RowID    VARCHAR(36) NOT NULL PRIMARY KEY,
            


        
5条回答
  •  攒了一身酷
    2021-02-19 02:15

    I would go with uniqueidentifier for many reasons such as,

    it will take less space; it's unique so it can not be duplicated. It's much better for comparisons and specially performance related issues as well as easy to get unique default value etc.

    I would use uniqueidentifier unless I need to use varchar for very specific reason.

提交回复
热议问题