sql server - How do you determine what SQL Tables have an identity column programmatically -


i want create list of columns in sql server 2005 have identity columns , corresponding table in t-sql.

results like:

tablename, columnname

another potential way sql server, has less reliance on system tables (which subject change, version version) use information_schema views:

select column_name, table_name information_schema.columns columnproperty(object_id(table_schema+'.'+table_name), column_name, 'isidentity') = 1 order table_name  

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -