views:

250

answers:

1

I am new to Sql Server Compact Edition (CE). How to alter a table in Sql Server CE? I have an existing table, and I need to add identity column.

+3  A: 

You add a column in the same way you would add it in other versions of SQL Server:

This adds a primary key identity column called IdColumnName to the table tableName:

ALTER TABLE tableName
ADD COLUMN (IdColumnName INTEGER IDENTITY (1,1) PRIMARY KEY)

See the ALTER TABLE syntax for SQL Server compact edition.

Oded