{"id":2030,"date":"2025-04-05T11:25:12","date_gmt":"2025-04-05T02:25:12","guid":{"rendered":"https:\/\/euc-access-excel-db.com\/tips\/?p=2030"},"modified":"2025-04-05T11:34:16","modified_gmt":"2025-04-05T02:34:16","slug":"sql-cmd-variant-array01","status":"publish","type":"post","link":"https:\/\/euc-access-excel-db.com\/tips\/ct07_se\/ct075012_xls2k_vba_tips\/sql-cmd-variant-array01","title":{"rendered":"\u2605ExcelVBA ~ SQL\u30b3\u30de\u30f3\u30c9\u3092\u914d\u5217\u5316\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\uff08ODBC\u63a5\u7d9a\u6642\u306eQueryTable\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\u306b\u304a\u3044\u3066\uff09"},"content":{"rendered":"<p>\u2605ExcelVBA ~ SQL\u30b3\u30de\u30f3\u30c9\u3092\u914d\u5217\u5316\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\uff08ODBC\u63a5\u7d9a\u6642\u306eQueryTable\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\u306b\u304a\u3044\u3066\uff09<br \/>\n<SPAN>\u3000\u3000<\/SPAN><br \/>\n<span style=\"color: #ff0000;\">\u203b\u307e\u3060\u66f8\u304d\u304b\u3051\u3067\u3059\u3002\u3059\u307f\u307e\u305b\u3093\u3002<\/span><br \/>\n<span style=\"color: #ff0000;\">\u203b\u9593\u9055\u3063\u3066\u305f\u3089\u3059\u307f\u307e\u305b\u3093\u3002<\/span><br \/>\n<span style=\"color: #ff0000;\">\u203b\u30e1\u30e2\u66f8\u304d\u306a\u306e\u3067\u3001\u81ea\u5206\u3067\u3082\u610f\u5473\u4e0d\u660e\u306a\u7b87\u6240\u3082\u591a\u3044\u3067\u3059\u3002\u3054\u3081\u3093\u306a\u3055\u3044\u3002<\/span><\/p>\n<p><SPAN>\u3000\u3000<\/SPAN><\/p>\n<p>QueryTable\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\u3067SQL\u30b3\u30de\u30f3\u30c9\u3092\u4f5c\u6210\u3059\u308b\u3068\u304d\u3001\u305f\u3044\u304c\u3044\u30c7\u30fc\u30bf\u578b\u304c\u3001\u300cVariant\u578b\u306e\u914d\u5217\u306b\u3057\u308d\u300d\u3068\u30d8\u30eb\u30d7\u306b\u66f8\u3044\u3066\u3042\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u4f5c\u308b\u305f\u3081\u306b\u4f7f\u3044\u307e\u3059\u3002<br \/>\n\u4ee5\u524d\u306f390\u6587\u5b57\u305a\u3064\u304f\u3089\u3044\u3067\u30c1\u30e7\u30f3\u5207\u3063\u3066\u30a8\u30e9\u30fc\u304c\u7121\u304b\u3063\u305f\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f255\u6587\u5b57\u3054\u3068\u3058\u3083\u306a\u3044\u3068\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u305d\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u4f5c\u308a\u307e\u3057\u305f\u3002<br \/>\n\uff08\u30c1\u30e7\u30f3\u5207\u308b\u6587\u5b57\u6570\u3092\u53ef\u5909\u306b\u3057\u307e\u3057\u305f\u3002SQL\u4f5c\u6210\u4ee5\u5916\u3067\u3082\u4f7f\u3048\u307e\u3059\u3002\uff09<\/p>\n<pre class=\"lang:default decode:true \">\r\n'\r\n'\r\nOption Explicit\r\n\r\n\r\n'###############################################################################\r\n'SQL\u30b3\u30de\u30f3\u30c9\u306e\u914d\u5217\uff08Variant\u578b\uff09\u3092\u3001\u6587\u5b57\u6570\u533a\u5207\u308a\u3067\u751f\u6210\u3059\u308b\u95a2\u6570\r\n'SQL\u4ee5\u5916\u306b\u3082\u6587\u5b57\u5217\u3092\u6587\u5b57\u6570\u533a\u5207\u308a\u3067\u914d\u5217\u5316\u3057\u305f\u3044\u3068\u304d\u306b\u3082\u4f7f\u3048\u307e\u3059\u3002\r\n'\r\n' Call SQLCmdAryMake01(\u533a\u5207\u308a\u305f\u3044\u6587\u5b57\u5217 , \u533a\u5207\u308b\u6587\u5b57\u6570)\r\n'\r\n'###############################################################################\r\n\r\nFunction SQLCmdAryMake01(ByVal s_SqlStr01jj As String, ByVal i_SplitNum01 As Integer) As Variant\r\n\r\n'    Dim s_SqlStr01jj    As String\r\n'    Dim i_SplitNum01    As Integer 'SQL\u30b3\u30de\u30f3\u30c9\u306e\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\u306e\u306b\u3001\u4f55\u6587\u5b57\u3054\u3068\u306bSplit\u3059\u308b\u304b\u306e\u6587\u5b57\u6570\r\n\r\n    Dim Ary_s_SQL01()   As Variant\r\n    Dim i_Cnt01         As Integer\r\n    Dim s_Chunk         As String  'Chunk\uff1d\u304b\u305f\u307e\u308a\r\n    Dim i_ChunkNum01    As Integer 'i_ChunkNum01\uff1d255\u6587\u5b57\u3054\u3068\u306e\u304b\u305f\u307e\u308a\u306e\u6570\uff08\u2192\u3064\u307e\u308a\u3001\u8981\u7d20\u6570\u306b\u306a\u308b\uff09\r\n\r\n\r\n'    s_SqlStr01jj = \"galgkjaldsgjalsjga\"\r\n\r\n'    i_SplitNum01 = 5\r\n    'SQL\u30b3\u30de\u30f3\u30c9\u306e\u914d\u5217\u306e\u5404\u8981\u7d20\u306b\u683c\u7d0d\u3059\u308b\u6587\u5b57\u6570\u306e\u8a2d\u5b9a\u3002256\u6587\u5b57\u4ee5\u4e0a\u306f\u30c0\u30e1\u3060\u3063\u305f \u3002\r\n    \r\n    i_ChunkNum01 = Len(s_SqlStr01jj) \\ i_SplitNum01 + IIf(Len(s_SqlStr01jj) Mod i_SplitNum01 > 0, 1, 0)\r\n    'SQL\u3092255\u6587\u5b57\u306e\u304b\u305f\u307e\u308a\u306b\u3059\u308b\u3068\u3001\u3044\u304f\u3064\u306e\u8981\u7d20\u6570\u306b\u306a\u308b\u304b\u306e\u8a08\u7b97\u3002\r\n    \r\n'    Stop\r\n \r\n    ReDim Ary_s_SQL01(0 To i_ChunkNum01 - 1)\r\n    '\u7a7a\u306e\u914d\u5217\u3092\u751f\u6210\u3002\r\n    \r\n    For i_Cnt01 = 0 To (i_ChunkNum01 - 1)\r\n        s_Chunk = Mid(s_SqlStr01jj, i_Cnt01 * i_SplitNum01 + 1, i_SplitNum01)\r\n        Ary_s_SQL01(i_Cnt01) = s_Chunk\r\n    Next i_Cnt01\r\n    ' 255\u6587\u5b57\u305a\u3064\u53d6\u308a\u51fa\u3057\u3066\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\u30eb\u30fc\u30d7\u3002\r\n    \r\n    SQLCmdAryMake01 = Ary_s_SQL01\r\n    \r\n\r\nEnd Function\r\n\r\n'\r\n'\r\n<\/pre>\n<p><SPAN>\u3000\u3000<\/SPAN><\/p>\n<p><SPAN>\u3000\u3000<\/SPAN><br \/>\n<SPAN>\u3000\u3000<\/SPAN><br \/>\n<SPAN>\u3000\u3000<\/SPAN><br \/>\n<SPAN>\u3000\u3000<\/SPAN><br \/>\n<SPAN>\u3000\u3000<\/SPAN><\/p>\n","protected":false},"excerpt":{"rendered":"\u2605ExcelVBA ~ SQL\u30b3\u30de\u30f3\u30c9\u3092\u914d\u5217\u5316\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\uff08ODBC\u63a5\u7d9a\u6642\u306eQueryTable\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\u306b\u304a\u3044\u3066\uff09 \u3000\u3000 \u203b\u307e\u3060\u66f8\u304d\u304b\u3051\u3067\u3059\u3002\u3059\u307f\u307e\u305b\u3093\u3002 \u203b\u9593\u9055\u3063\u3066\u305f\u3089\u3059\u307f\u307e\u305b\u3093\u3002 \u203b\u30e1\u30e2\u66f8\u304d\u306a\u306e\u3067\u3001\u81ea\u5206\u3067\u3082 ...","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[234],"_links":{"self":[{"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/posts\/2030"}],"collection":[{"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/comments?post=2030"}],"version-history":[{"count":0,"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/posts\/2030\/revisions"}],"wp:attachment":[{"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/media?parent=2030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/euc-access-excel-db.com\/tips\/wp-json\/wp\/v2\/categories?post=2030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}