{"id":284,"date":"2015-08-09T08:45:01","date_gmt":"2015-08-09T08:45:01","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2015\/08\/09\/tsql-script-to-fetch-the-list-of-tables-with-identity-properties\/"},"modified":"2015-08-09T08:45:01","modified_gmt":"2015-08-09T08:45:01","slug":"tsql-script-to-fetch-the-list-of-tables-with-identity-properties","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2015\/08\/09\/tsql-script-to-fetch-the-list-of-tables-with-identity-properties\/","title":{"rendered":"TSQL Script to fetch the list of tables with identity properties"},"content":{"rendered":"

Below is the TSQL Script to fetch the list of tables in a database with identity column properties
\n[sql]
\nSELECT SCHEMA_NAME(T.SCHEMA_ID) AS SCHEMA_NAME,
\n OBJECT_NAME(T.OBJECT_ID) AS TABLENAME,
\n TI.NAME AS COLUMN_NAME,
\n TI.SEED_VALUE,
\n TI.INCREMENT_VALUE,
\n TI.LAST_VALUE AS LAST_VALUE
\nFROM SYS.TABLES AS T
\n INNER JOIN
\n SYS.IDENTITY_COLUMNS AS TI
\n ON T.OBJECT_ID = TI.OBJECT_ID
\n[\/sql]<\/p>\n","protected":false},"excerpt":{"rendered":"

Below is the TSQL Script to fetch the list of tables in a database with identity column properties [sql] SELECT SCHEMA_NAME(T.SCHEMA_ID) AS SCHEMA_NAME, OBJECT_NAME(T.OBJECT_ID) AS TABLENAME, TI.NAME AS COLUMN_NAME, TI.SEED_VALUE, TI.INCREMENT_VALUE, TI.LAST_VALUE AS LAST_VALUE FROM SYS.TABLES AS T INNER JOIN SYS.IDENTITY_COLUMNS AS TI ON T.OBJECT_ID = TI.OBJECT_ID [\/sql]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2173],"tags":[],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/284"}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=284"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/284\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}