I'm new to databases, and now creating SQLCE database in Management Studio. There is a value in brackets; [UQ_Users_0000000000000028], which seems a bit random to me, so would just like to ask if someone could explain this field?
Is it just simply required to be a unique field? Is there any reason why I would want to change it to something else than what SSMS scripts?
cheers!
C开发者_Go百科REATE TABLE [Users] (
[UserID] int NOT NULL
.....
CREATE UNIQUE INDEX [UQ__Users__0000000000000028] ON [Users] ([UserID] ASC);
Yes, I'd recommend changing it's name to make some kind of sense (useful when querying the system views), for example UQ_Users_UserID.
This was probably originally created with something like :-
CREATE TABLE [Users] ( [UserID] int UNIQUE NONCLUSTERED, .....
so SQL Server will have assigned it it's own (non-helpful) constraint name.
They are default constraint names designed to provide uniqueness across servers. I always name mine to avoid scripting issues.
精彩评论