SQL Server Developer Center > SQL Server Forums > SQL Server Compact > SQL CE Compact 3.5 Identity columns for a table.
Ask a questionAsk a question
 

AnswerSQL CE Compact 3.5 Identity columns for a table.

  • Sunday, November 01, 2009 6:43 PMrxm0203 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Is there a query I can write against an INFORMATION_SCHEMA or against the system tables to determine if a column is an identity column in SQL CE Compact version 3.5?

Answers

  • Sunday, November 01, 2009 10:48 PMJoão Paulo FigueiraMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Try the following query:

    SELECT 
        TABLE_NAME, COLUMN_NAME, AUTOINC_NEXT, AUTOINC_SEED, AUTOINC_INCREMENT 
    FROM 
        INFORMATION_SCHEMA.COLUMNS 
    WHERE 
        AUTOINC_NEXT IS NOT NULL 
    
    
    This query will report all the IDENTITY columns in your database. For each IDENTITY column it reports the next value, and the seed and increment values specified at creation time.
    João Paulo Figueira (Device Application Development MVP)

All Replies

  • Sunday, November 01, 2009 10:48 PMJoão Paulo FigueiraMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Try the following query:

    SELECT 
        TABLE_NAME, COLUMN_NAME, AUTOINC_NEXT, AUTOINC_SEED, AUTOINC_INCREMENT 
    FROM 
        INFORMATION_SCHEMA.COLUMNS 
    WHERE 
        AUTOINC_NEXT IS NOT NULL 
    
    
    This query will report all the IDENTITY columns in your database. For each IDENTITY column it reports the next value, and the seed and increment values specified at creation time.
    João Paulo Figueira (Device Application Development MVP)