{"id":10,"date":"2006-12-26T17:59:39","date_gmt":"2006-12-26T16:59:39","guid":{"rendered":"http:\/\/www.crydust.be\/blog\/2006\/12\/26\/mssql-lacks-describe-statement\/"},"modified":"2008-05-07T12:23:12","modified_gmt":"2008-05-07T10:23:12","slug":"mssql-lacks-describe-statement","status":"publish","type":"post","link":"http:\/\/www.crydust.be\/blog\/2006\/12\/26\/mssql-lacks-describe-statement\/","title":{"rendered":"MsSql lacks describe statement"},"content":{"rendered":"<p>Describe, or desc in short, is one of the most valuable commands when trying to understand a database structure. MsSql lacks this feature so you have to write it yourself.<\/p>\n<p><!--more--><\/p>\n<pre>\r\nSELECT\r\n    column_name\r\n,   data_type +\r\n    COALESCE(\r\n       '(' + CAST(character_maximum_length AS VARCHAR) + ')'\r\n    ,  '(' + CAST(numeric_precision AS VARCHAR) + ')'\r\n    ,  ''\r\n    )\r\n,   column_default\r\n,   is_nullable\r\nFROM\r\n    information_schema.columns\r\nWHERE\r\n    table_name = 'tablename';\r\n<\/pre>\n<p>Also see <a href=\"http:\/\/troels.arvin.dk\/db\/rdbms\/#cli-table_description\">Getting a table description<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Describe, or desc in short, is one of the most valuable commands when trying to understand a database structure. MsSql lacks this feature so you have to write it yourself.<\/p>\n<p> <a href=\"http:\/\/www.crydust.be\/blog\/2006\/12\/26\/mssql-lacks-describe-statement\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}