2

I have a column named FinderLogId in a table named FinderLog.

I wanna make it primary key and auto increment. What I tried is the following:

ALTER TABLE [gheymatyab.com_db].[dbo].[FinderLog] 
   ALTER COLUMN [FinderLogId] int NOT NULL IDENTITY PRIMARY KEY

And what I see in the result is this:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'IDENTITY'.

Whats the problem?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Hamid Reza
  • 2,913
  • 9
  • 49
  • 76

1 Answers1

3

Your question looks very similar to this issue:

Adding an identity to an existing column

You'll either need to add a new primary key column, or else create a new table. The linked question goes into specifics.

Community
  • 1
  • 1