Autonumber field in SQL Database CE
Is there anything like Autonumber field in SQL server CE database file, li开发者_运维技巧ke we have in Access? I want to get it incremented automatically. Thanks Furqan
Have a look at
IDENTITY Property (SQL Server Compact Edition)
Use IDENTITY:
CREATE TABLE myTable(
ID INT IDENTITY NOT NULL PRIMARY KEY,
Name VARCHAR(40) NOT NULL
)
CREATE TABLE Tool(
ID INT IDENTITY NOT NULL PRIMARY KEY,
Name VARCHAR(40) NOT NULL
)
Use IDENTITY :
CREATE TABLE t_test(
id INTEGER IDENTITY
PRIMARY KEY,
name VARCHAR(10)
);
精彩评论