Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Adding an Identity column as Primary Key

$
0
0
I created a table using a query, but the table needs an ID column as primary key. First question is: Is there a make table query command that will generate the ID column? Next question is: How long (best guess of course) should it take to run the query below on a million records?:[quote]ALTER TABLE myTableADD ID INT IDENTITY(1,1) NOT NULLALTER TABLE myTableADD CONSTRAINT PK_Grouped PRIMARY KEY(ID)[/quote]I started this query two days ago on an Azure database and it finally terminated with error:[quote]Msg 121, Level 20, State 0, Line 0A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)[/quote]

Viewing all articles
Browse latest Browse all 3145

Trending Articles