Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Knowing how to check whether a column is an identity column for Microsoft SQL Server, I currently still found no solution for doing the same with SQL for a Microsoft Access database.

My question:

How can I check with SQL whether a column is an identity column for a Microsoft Access database?

(Since I want to do it in my code, an ADO.NET solution would be helpful, too, although it seems, that this is not possible)

share|improve this question
add comment

1 Answer 1

Are you just wanting to see if the column is an identity of find the identity column in the table. If so try something like this and just extend the criteria

SELECT 
    t.name AS [TableName],
    c.Name AS [ColumnName],
    c.is_identity
FROM 
    sys.tables t
    INNER JOIN sys.columns c
        ON t.object_id = c.object_id
WHERE c.is_identity = 1
share|improve this answer
1  
Are you sure that Microsoft Access has the sys.tables and sys.columns? When I try your suggestion, Access complains about missing database "sys.mdb". –  Uwe Keim Oct 16 '13 at 7:38
1  
No. Msysobjects is a system table in Access. –  msi77 Oct 17 '13 at 5:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.