{"id":19,"date":"2008-03-18T17:11:43","date_gmt":"2008-03-19T00:11:43","guid":{"rendered":"http:\/\/shivdev.com\/blog\/2008\/03\/18\/sql-server-quick-workaround-to-declare-arrays\/"},"modified":"2011-05-06T07:26:53","modified_gmt":"2011-05-06T07:26:53","slug":"sql-server-quick-workaround-to-declare-arrays","status":"publish","type":"post","link":"http:\/\/shivdev.com\/blog\/2008\/03\/18\/sql-server-quick-workaround-to-declare-arrays\/","title":{"rendered":"SQL Server Quick Workaround To Declare Arrays"},"content":{"rendered":"<p><strong>Need a quick workaround to declaring arrays in SQL Server?<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n-- Trying to accomplish something like this?\r\nint[] @list = {1864, 1966} -- INCORRECT SQL \r\nSELECT * FROM Employees\r\nWHERE id IN @list<\/pre>\n<p><strong>Here&#8217;s a workaround<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nDECLARE @list TABLE (id int)          -- create an int[] &quot;array&quot;\r\nINSERT @list VALUES (1864)            -- hardcode values\r\nINSERT @list VALUES (1966)            -- hardcode values\r\nSELECT * FROM Employees               -- my query\r\nWHERE id IN (SELECT id FROM @list)    -- use the int[] array<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Need a quick workaround to declaring arrays in SQL Server? Here&#8217;s a workaround<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/19"}],"collection":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":189,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions\/189"}],"wp:attachment":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}