Should I Use GUID or IDENTITY as Thread Number?
offerID is the thread # which represents the thread posted. I see in forums posts are represented by random numbers. Is this achieved by IDENTITY? If not, please advice.
nvarchar(max) will carry all kind of texts along with HTML tags.
CREATE TA开发者_运维问答BLE Offer
(
offerID int IDENTITY (4382,15) PRIMARY KEY,
memberID int NOT NULL REFERENCES Member(memberID),
title nvarchar(200) NOT NULL,
thread nvarchar(max) NOT NULL,
.
.
.
);
Identity is not random numbers but incrementing. This means that you're not assigning the id number but the database is automatically setting it for you based on what identity number was set last time.
I would always recommend int identity since its more compact and humans have a chance to remember them. A GUID is always 128 bit long, has no direct meaning and is difficult to remember. It usually looks ugly in the url as well.
精彩评论