Problem:
You need to add a primary Key to a table.
Solution:
Heres a few types I've run across.
Manual Primary Key
CREATE TABLE [dbo].[HtmlDtos]([Id] [int] PRIMARY KEY)
Auto Sequential Int Primary Key
CREATE TABLE [dbo].[HtmlDtos]([Id] [int] IDENTITY(1,1) PRIMARY KEY)
Auto Sequential GUID PK
CREATE TABLE [dbo].[HtmlDtos] ([Id] UNIQUEIDENTIFIER DEFAULT NEWSEQUENTIALID() PRIMARY KEY)
Auto Random GUID PK
CREATE TABLE [dbo].[HtmlDtos]([Id] UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY)
Top comments (0)