Home » Programming / Coding

How to Check if a Column is Identity – MS SQL

28 May 2010 562 views No Comment

How to Check if a Column is Identity in MS SQL

SELECT name, is_identity
FROM sys.columns
WHERE [object_id] = object_id(‘MyTable’)

This will list all the table column names with is_identity column value set to 1 if the column is identity.

Taken from our forum post: http://www.webcosmoforums.com/databases/19193-how-check-if-column-identity-ms-sql.html

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.