[{"data":1,"prerenderedAt":131},["ShallowReactive",2],{"post:show-columns-in-table":3},{"id":4,"title":5,"body":6,"date":118,"description":119,"draft":120,"extension":121,"meta":122,"navigation":123,"path":124,"seo":125,"stem":126,"tags":127,"__hash__":130},"posts\u002Fposts\u002Fshow-columns-in-table.md","TIL: How to Show Column Types like MySQL's \"Show Columns\" statement",{"type":7,"value":8,"toc":116},"minimark",[9,22,85,99,112],[10,11,12,13,17,18,21],"p",{},"For all those MySQL devs who miss the simplicity of ",[14,15,16],"code",{},"SHOW CREATE TABLE myTable"," or ",[14,19,20],{},"SHOW COLUMNS FROM myTable",", here's the snippet you are looking for.",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-sql shiki shiki-themes github-light github-dark","SELECT COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,COLUMN_DEFAULT\nFROM INFORMATION_SCHEMA.COLUMNS\nWHERE TABLE_NAME = 'myTable'\nORDER BY COLUMN_NAME;\n","sql","",[14,30,31,44,60,76],{"__ignoreMap":28},[32,33,36,40],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"szBVR","SELECT",[32,41,43],{"class":42},"sVt8B"," COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,COLUMN_DEFAULT\n",[32,45,47,50,54,57],{"class":34,"line":46},2,[32,48,49],{"class":38},"FROM",[32,51,53],{"class":52},"sj4cs"," INFORMATION_SCHEMA",[32,55,56],{"class":42},".",[32,58,59],{"class":52},"COLUMNS\n",[32,61,63,66,69,72],{"class":34,"line":62},3,[32,64,65],{"class":38},"WHERE",[32,67,68],{"class":42}," TABLE_NAME ",[32,70,71],{"class":38},"=",[32,73,75],{"class":74},"sZZnC"," 'myTable'\n",[32,77,79,82],{"class":34,"line":78},4,[32,80,81],{"class":38},"ORDER BY",[32,83,84],{"class":42}," COLUMN_NAME;\n",[10,86,87,88,98],{},"(After I wrote all that...) nevermind, use ",[89,90,94,97],"a",{"href":91,"rel":92},"https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fsql\u002Frelational-databases\u002Fsystem-stored-procedures\u002Fsp-columns-transact-sql?view=sql-server-2017",[93],"nofollow",[14,95,96],{},"sp_columns"," command",", it is a lot more useful and easier to remember.",[23,100,102],{"className":25,"code":101,"language":27,"meta":28,"style":28},"EXEC sp_columns myTable\n",[14,103,104],{"__ignoreMap":28},[32,105,106,109],{"class":34,"line":35},[32,107,108],{"class":38},"EXEC",[32,110,111],{"class":42}," sp_columns myTable\n",[113,114,115],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":28,"searchDepth":46,"depth":46,"links":117},[],"2018-12-19T11:02:40-05:00","For all those MySQL devs who miss the simplicity of SHOW CREATE TABLE myTable or SHOW COLUMNS FROM myTable, here's the snippet you are looking for.",false,"md",{},true,"\u002Fposts\u002Fshow-columns-in-table",{"title":5,"description":119},"posts\u002Fshow-columns-in-table",[128,129],"sql-server","til","uHbrA0bU2KAMrVV4mKSUHbWbqH6YZO94gicGIUTJfhA",1790471528065]