How to insert into a table with just one IDENTITY column (SQL Server CE)
Posted
by Hei
on Stack Overflow
See other posts from Stack Overflow
or by Hei
Published on 2010-04-01T06:59:12Z
Indexed on
2010/04/01
7:03 UTC
Read the original article
Hit count: 186
sql-server-ce
|tsql
Hello
I am trying to insert a value in a one IDENTITY column Table in SQL Server CE 3.5. I Tried the following:
INSERT Target DEFAULT VALUES
INSERT Target (ID) VALUES (DEFAULT)
INSERT Target (ID) VALUES ()
But none of them worked. This is the SQL command I used to create the table (Using SQL Server Management Studio):
CREATE TABLE Target(
ID int NOT NULL IDENTITY (1, 1) PRIMARY KEY
);
Microsoft help site (http://msdn.microsoft.com/en-us/library/ms174633%28SQL.90%29.aspx) mentions that DEFAULT values are not valid for identity columns however they do not mention any alternative.
They mention something about uniqueidentifier and ROWGUID but I have not been able to make it work.
I would appreciate any pointers on how to solve this problem or links to documentation about valid sql commands for sql server CE.
Thank you
© Stack Overflow or respective owner