{"id":18158,"date":"2024-10-03T06:00:00","date_gmt":"2024-10-02T21:00:00","guid":{"rendered":"https:\/\/www.muscle-hypertrophy.com\/?p=18158"},"modified":"2024-10-02T14:06:18","modified_gmt":"2024-10-02T05:06:18","slug":"sql-server%e3%81%ae%e5%86%8d%e5%b8%b0%e5%85%b1%e9%80%9a%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e5%bc%8f%e3%81%a7%e9%80%a3%e7%95%aa%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.muscle-hypertrophy.com\/?p=18158","title":{"rendered":"SQL Server\u306e\u518d\u5e30\u5171\u901a\u30c6\u30fc\u30d6\u30eb\u5f0f\u3067\u9023\u756a\u3092\u4f5c\u6210\u3059\u308b"},"content":{"rendered":"\n<p>\u3000\u6a19\u6e96SQL\u304c\u518d\u5e30\u5171\u901a\u30c6\u30fc\u30d6\u30eb\u5f0f\u306b\u5bfe\u5fdc\u3057\u305f\u306e\u306fSQL:1999\u304b\u3089\u3067\u3042\u308b\uff0e\u4eca\u56de\u306fSQL Server\u306e\u518d\u5e30\u5171\u901a\u30c6\u30fc\u30d6\u30eb\u5f0f\u3067\u9023\u756a\u3092\u4f5c\u6210\u3059\u308b\uff0e\u65e5\u4ed8\u306e\u9023\u756a\u3082\u4f5c\u6210\u3057\u3066\u307f\u308b\uff0e<\/p>\n<p><!--more--><\/p>\n<h2>\u9023\u756a\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u3000\u4e0b\u8a18\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3059\u308b\uff0e<\/p>\n<pre>WITH CTE(num) AS\n(\nSELECT\t1 AS num\nUNION ALL\nSELECT num + 1 AS num\nFROM\tCTE\nWHERE\tnum &lt;= 99\n)\nSELECT\tnum\nFROM\tCTE;<\/pre>\n<h2>\u7d50\u679c<\/h2>\n<pre>num\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78\n79\n80\n81\n82\n83\n84\n85\n86\n87\n88\n89\n90\n91\n92\n93\n94\n95\n96\n97\n98\n99\n100<\/pre>\n<h2>\u65e5\u4ed8\u306e\u9023\u756a\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u3000\u4e0b\u8a18\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3059\u308b\uff0eMAXRECURSION \u3092 0 \u306b\u8a2d\u5b9a\u3057\uff0c\u901a\u5e38\u306f100\u306b\u898f\u5b9a\u3055\u308c\u3066\u3044\u308b\u518d\u5e30\u30ec\u30d9\u30eb\u3092\u7121\u5236\u9650\u3068\u3057\u3066\u3044\u308b\uff0e<\/p>\n<pre>WITH DateGenerate(cur_date)\nAS\n(\nSELECT\tCONVERT(date, GETDATE())\tAS cur_date\nUNION ALL\nSELECT\tDATEADD(DAY, 1, cur_date)\tAS cur_date\nFROM\tDateGenerate\nWHERE\tcur_date &lt; CAST('9999-12-31' AS date)\n)\nSELECT\tcur_date\nFROM\tDateGenerate\nOPTION (MAXRECURSION 0)<\/pre>\n<h2>\u7d50\u679c<\/h2>\n<pre>(2912899 \u884c\u51e6\u7406\u3055\u308c\u307e\u3057\u305f)<\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u3000\u518d\u5e30\u5171\u901a\u30c6\u30fc\u30d6\u30eb\u5f0f\u3067\u9023\u756a\u3068\u65e5\u4ed8\u306e\u9023\u756a\u3092\u4f5c\u6210\u3057\u305f\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u6a19\u6e96SQL\u304c\u518d\u5e30\u5171\u901a\u30c6\u30fc\u30d6\u30eb\u5f0f\u306b\u5bfe\u5fdc\u3057\u305f\u306e\u306fSQL:1999\u304b\u3089\u3067\u3042\u308b\uff0e\u4eca\u56de\u306fSQL Server\u306e\u518d\u5e30\u5171\u901a\u30c6\u30fc\u30d6\u30eb\u5f0f\u3067\u9023\u756a\u3092\u4f5c\u6210\u3059\u308b\uff0e\u65e5\u4ed8\u306e\u9023\u756a\u3082\u4f5c\u6210\u3057\u3066\u307f\u308b\uff0e<\/p>\n","protected":false},"author":1,"featured_media":15391,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[7594,13817,2884,8150,13818,13815,13820,2740,13814,12453,4658,13816,13812,442,13813,2680,9297],"class_list":["post-18158","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-cast","tag-convert","tag-date","tag-day","tag-getdate","tag-maxrecursion","tag-option","tag-sql-server","tag-sql1999","tag-union-all","tag-with","tag-13816","tag-13812","tag-442","tag-sql","tag-2680","tag-9297"],"_links":{"self":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts\/18158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18158"}],"version-history":[{"count":11,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts\/18158\/revisions"}],"predecessor-version":[{"id":18169,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/posts\/18158\/revisions\/18169"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=\/wp\/v2\/media\/15391"}],"wp:attachment":[{"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muscle-hypertrophy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}