{"id":92,"date":"2011-05-13T16:52:30","date_gmt":"2011-05-14T02:52:30","guid":{"rendered":"http:\/\/mymonkeydo.com\/?p=92"},"modified":"2011-05-13T16:52:30","modified_gmt":"2011-05-14T02:52:30","slug":"get-all-rows-into-one-string","status":"publish","type":"post","link":"https:\/\/mymonkeydo.com\/get-all-rows-into-one-string\/","title":{"rendered":"Get All rows into One String"},"content":{"rendered":"
This is an easy way to get all rows from a SQL table into a string:<\/p>\n
\nselect stuff((\n select ', ' + a_column\n from [name_of_table]\n order by table_id\n for xml path('')\n ), 1, 1, '')\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[2],"tags":[49],"yoast_head":"\nGet All rows into One String - My Monkey Do<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\t\n