Skip to content

Instantly share code, notes, and snippets.

@arekgotfryd
Created February 8, 2019 08:44
Show Gist options
  • Save arekgotfryd/8d01135f44882b93677b9a83a010dbbb to your computer and use it in GitHub Desktop.
Save arekgotfryd/8d01135f44882b93677b9a83a010dbbb to your computer and use it in GitHub Desktop.
sql-server-add-auto-increment-primary-key-to-existing-table
ALTER TABLE dbo.YourTable
ADD ID INT IDENTITY
CONSTRAINT PK_YourTable PRIMARY KEY CLUSTERED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment