{"id":1343,"date":"2017-02-04T14:59:24","date_gmt":"2017-02-04T14:59:24","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=1343"},"modified":"2017-02-04T15:01:07","modified_gmt":"2017-02-04T15:01:07","slug":"list-all-identity-columns-in-a-database-in-sql-server","status":"publish","type":"post","link":"https:\/\/www.theSQLReport.com\/?p=1343","title":{"rendered":"List All Identity Columns in a Database in SQL Server"},"content":{"rendered":"<p>Problem: Received a request for a list of all identity columns existing in a database.\u00a0 The example is from the SQL 2016 sample database: WideWorldImporters<\/p>\n<pre>SELECT\r\n o.name as 'OWNER',\r\n t.name AS 'TABLENAME',\r\n i.name AS 'COLUMN'\r\nFROM sys.schemas AS o\r\nINNER JOIN sys.tables AS t\r\n ON o.[schema_id] = t.[schema_id]\r\nINNER JOIN sys.identity_columns i\r\nON i.[object_id] = t.[object_id]\r\norder by 1,2,3;<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2017\/02\/IdentityColumnsResults.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1344 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2017\/02\/IdentityColumnsResults.jpg\" alt=\"All Identity Columns In A Database Results \" width=\"583\" height=\"407\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: Received a request for a list of all identity columns existing in a database.\u00a0 The example is from the SQL 2016 sample database: WideWorldImporters SELECT o.name as &#8216;OWNER&#8217;, t.name &hellip; <a class=\"readmore\" href=\"https:\/\/www.theSQLReport.com\/?p=1343\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1344,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[93],"class_list":["post-1343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server","tag-identity-columns"],"_links":{"self":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1343"}],"collection":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1343"}],"version-history":[{"count":3,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1343\/revisions"}],"predecessor-version":[{"id":1347,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1343\/revisions\/1347"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/1344"}],"wp:attachment":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}