How to get current identity number of specific table in sql server compact
SELECT IDENT_SEED(TABLE_SCHEMA+'.'+TABLE_NAME) AS Seed,
IDENT_INCR(TABLE_SCHEMA+'.'+TABLE_NAME) AS Increment,
IDENT_CURRENT(TABLE_SCHEMA+'.'+TABLE_NAME) AS Current_Identity,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_SCHEMA+'.'+TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE'
To check the identity:
DBCC CHECKIDENT ('[schema].[YourTableName]', NORESEED);
To reseed the identity:
DBCC CHECKIDENT ('[schema].[YourTableName]', RESEED, value);
If you want to get a last identity inserted value for a particular table use the following statement:
select IDENT_CURRENT('tablename')
For example:
select IDENT_CURRENT('Employee')