SQLServerには半角文字を全角文字に変換したり、全角文字を半角に変換してくれる関数がありません。
そこで、SQLで全角を半角に変換、半角を全角に変換するクエリを作成しました。
SQLServerではCLR関数を作成することで、Visual Basic(またはC#)でStrConv関数を使用して変換する処理を実装し、コンパイルして作成したdllを使って実現することもできますが、ここではSQLのみで変換するために、1文字ずつREPLACE関数で処理を行っています。
全角から半角へ変換
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
-- 変換する文字列 DECLARE @string nvarchar(4000); SET @string = N'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!”“#$%&’()ー-=^~¥|‘「[{+;*:」]}、,<。.>/・?_×÷ 〈【『〔≪《〉】』〕≫》ヴガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンァィゥェォッャュョヶヵ0123456789'; /* 小文字アルファベット */ SET @string = REPLACE(@string, 'a', 'a'); SET @string = REPLACE(@string, 'b', 'b'); SET @string = REPLACE(@string, 'c', 'c'); SET @string = REPLACE(@string, 'd', 'd'); SET @string = REPLACE(@string, 'e', 'e'); SET @string = REPLACE(@string, 'f', 'f'); SET @string = REPLACE(@string, 'g', 'g'); SET @string = REPLACE(@string, 'h', 'h'); SET @string = REPLACE(@string, 'i', 'i'); SET @string = REPLACE(@string, 'j', 'j'); SET @string = REPLACE(@string, 'k', 'k'); SET @string = REPLACE(@string, 'l', 'l'); SET @string = REPLACE(@string, 'm', 'm'); SET @string = REPLACE(@string, 'n', 'n'); SET @string = REPLACE(@string, 'o', 'o'); SET @string = REPLACE(@string, 'p', 'p'); SET @string = REPLACE(@string, 'q', 'q'); SET @string = REPLACE(@string, 'r', 'r'); SET @string = REPLACE(@string, 's', 's'); SET @string = REPLACE(@string, 't', 't'); SET @string = REPLACE(@string, 'u', 'u'); SET @string = REPLACE(@string, 'v', 'v'); SET @string = REPLACE(@string, 'w', 'w'); SET @string = REPLACE(@string, 'x', 'x'); SET @string = REPLACE(@string, 'y', 'y'); SET @string = REPLACE(@string, 'z', 'z'); /* 大文字アルファベット */ SET @string = REPLACE(@string, 'A', 'A'); SET @string = REPLACE(@string, 'B', 'B'); SET @string = REPLACE(@string, 'C', 'C'); SET @string = REPLACE(@string, 'D', 'D'); SET @string = REPLACE(@string, 'E', 'E'); SET @string = REPLACE(@string, 'F', 'F'); SET @string = REPLACE(@string, 'G', 'G'); SET @string = REPLACE(@string, 'H', 'H'); SET @string = REPLACE(@string, 'I', 'I'); SET @string = REPLACE(@string, 'J', 'J'); SET @string = REPLACE(@string, 'K', 'K'); SET @string = REPLACE(@string, 'L', 'L'); SET @string = REPLACE(@string, 'M', 'M'); SET @string = REPLACE(@string, 'N', 'N'); SET @string = REPLACE(@string, 'O', 'O'); SET @string = REPLACE(@string, 'P', 'P'); SET @string = REPLACE(@string, 'Q', 'Q'); SET @string = REPLACE(@string, 'R', 'R'); SET @string = REPLACE(@string, 'S', 'S'); SET @string = REPLACE(@string, 'T', 'T'); SET @string = REPLACE(@string, 'U', 'U'); SET @string = REPLACE(@string, 'V', 'V'); SET @string = REPLACE(@string, 'W', 'W'); SET @string = REPLACE(@string, 'X', 'X'); SET @string = REPLACE(@string, 'Y', 'Y'); SET @string = REPLACE(@string, 'Z', 'Z'); /* 記号など */ SET @string = REPLACE(@string, '!', '!'); SET @string = REPLACE(@string, '”', '"'); SET @string = REPLACE(@string, '“', '"'); SET @string = REPLACE(@string, '#', '#'); SET @string = REPLACE(@string, '$', '$'); SET @string = REPLACE(@string, '%', '%'); SET @string = REPLACE(@string, '&', '&'); SET @string = REPLACE(@string, '’', ''''); SET @string = REPLACE(@string, '(', '('); SET @string = REPLACE(@string, ')', ')'); SET @string = REPLACE(@string, 'ー', 'ー'); SET @string = REPLACE(@string, '-', '-'); SET @string = REPLACE(@string, '=', '='); SET @string = REPLACE(@string, '^', '^'); SET @string = REPLACE(@string, '~', '~'); SET @string = REPLACE(@string, '¥', '\'); SET @string = REPLACE(@string, '|', '|'); SET @string = REPLACE(@string, '‘', '`'); SET @string = REPLACE(@string, '「', '['); SET @string = REPLACE(@string, '[', '['); SET @string = REPLACE(@string, '{', '{'); SET @string = REPLACE(@string, '+', '+'); SET @string = REPLACE(@string, ';', ';'); SET @string = REPLACE(@string, '*', '*'); SET @string = REPLACE(@string, ':', ':'); SET @string = REPLACE(@string, '」', ']'); SET @string = REPLACE(@string, ']', ']'); SET @string = REPLACE(@string, '}', '}'); SET @string = REPLACE(@string, '、', ','); SET @string = REPLACE(@string, ',', ','); SET @string = REPLACE(@string, '<', '<'); SET @string = REPLACE(@string, '。', '.'); SET @string = REPLACE(@string, '.', '.'); SET @string = REPLACE(@string, '>', '>'); SET @string = REPLACE(@string, '/', '/'); SET @string = REPLACE(@string, '・', '/'); SET @string = REPLACE(@string, '?', '?'); SET @string = REPLACE(@string, '_', '_'); SET @string = REPLACE(@string, '×', '*'); SET @string = REPLACE(@string, '÷', '/'); SET @string = REPLACE(@string, ' ', ' '); SET @string = REPLACE(@string, '〈', '('); SET @string = REPLACE(@string, '【', '['); SET @string = REPLACE(@string, '『', '['); SET @string = REPLACE(@string, '〔', '['); SET @string = REPLACE(@string, '≪', '<<'); SET @string = REPLACE(@string, '《', '(('); SET @string = REPLACE(@string, '〉', ')'); SET @string = REPLACE(@string, '】', ']'); SET @string = REPLACE(@string, '』', ']'); SET @string = REPLACE(@string, '〕', ']'); SET @string = REPLACE(@string, '≫', '>>'); SET @string = REPLACE(@string, '》', '))'); /* カタカナ */ -- 濁音、半濁音(半角2文字へ変換) SET @string = REPLACE(@string, 'ヴ', 'ヴ'); SET @string = REPLACE(@string, 'ガ', 'ガ'); SET @string = REPLACE(@string, 'ギ', 'ギ'); SET @string = REPLACE(@string, 'グ', 'グ'); SET @string = REPLACE(@string, 'ゲ', 'ゲ'); SET @string = REPLACE(@string, 'ゴ', 'ゴ'); SET @string = REPLACE(@string, 'ザ', 'ザ'); SET @string = REPLACE(@string, 'ジ', 'ジ'); SET @string = REPLACE(@string, 'ズ', 'ズ'); SET @string = REPLACE(@string, 'ゼ', 'ゼ'); SET @string = REPLACE(@string, 'ゾ', 'ゾ'); SET @string = REPLACE(@string, 'ダ', 'ダ'); SET @string = REPLACE(@string, 'ヂ', 'ヂ'); SET @string = REPLACE(@string, 'ヅ', 'ヅ'); SET @string = REPLACE(@string, 'デ', 'デ'); SET @string = REPLACE(@string, 'ド', 'ド'); SET @string = REPLACE(@string, 'バ', 'バ'); SET @string = REPLACE(@string, 'ビ', 'ビ'); SET @string = REPLACE(@string, 'ブ', 'ブ'); SET @string = REPLACE(@string, 'ベ', 'ベ'); SET @string = REPLACE(@string, 'ボ', 'ボ'); SET @string = REPLACE(@string, 'パ', 'パ'); SET @string = REPLACE(@string, 'ピ', 'ピ'); SET @string = REPLACE(@string, 'プ', 'プ'); SET @string = REPLACE(@string, 'ペ', 'ペ'); SET @string = REPLACE(@string, 'ポ', 'ポ'); -- 通常 SET @string = REPLACE(@string, 'ア', 'ア'); SET @string = REPLACE(@string, 'イ', 'イ'); SET @string = REPLACE(@string, 'ウ', 'ウ'); SET @string = REPLACE(@string, 'エ', 'エ'); SET @string = REPLACE(@string, 'オ', 'オ'); SET @string = REPLACE(@string, 'カ', 'カ'); SET @string = REPLACE(@string, 'キ', 'キ'); SET @string = REPLACE(@string, 'ク', 'ク'); SET @string = REPLACE(@string, 'ケ', 'ケ'); SET @string = REPLACE(@string, 'コ', 'コ'); SET @string = REPLACE(@string, 'サ', 'サ'); SET @string = REPLACE(@string, 'シ', 'シ'); SET @string = REPLACE(@string, 'ス', 'ス'); SET @string = REPLACE(@string, 'セ', 'セ'); SET @string = REPLACE(@string, 'ソ', 'ソ'); SET @string = REPLACE(@string, 'タ', 'タ'); SET @string = REPLACE(@string, 'チ', 'チ'); SET @string = REPLACE(@string, 'ツ', 'ツ'); SET @string = REPLACE(@string, 'テ', 'テ'); SET @string = REPLACE(@string, 'ト', 'ト'); SET @string = REPLACE(@string, 'ナ', 'ナ'); SET @string = REPLACE(@string, 'ニ', 'ニ'); SET @string = REPLACE(@string, 'ヌ', 'ヌ'); SET @string = REPLACE(@string, 'ネ', 'ネ'); SET @string = REPLACE(@string, 'ノ', 'ノ'); SET @string = REPLACE(@string, 'ハ', 'ハ'); SET @string = REPLACE(@string, 'ヒ', 'ヒ'); SET @string = REPLACE(@string, 'フ', 'フ'); SET @string = REPLACE(@string, 'ヘ', 'ヘ'); SET @string = REPLACE(@string, 'ホ', 'ホ'); SET @string = REPLACE(@string, 'マ', 'マ'); SET @string = REPLACE(@string, 'ミ', 'ミ'); SET @string = REPLACE(@string, 'ム', 'ム'); SET @string = REPLACE(@string, 'メ', 'メ'); SET @string = REPLACE(@string, 'モ', 'モ'); SET @string = REPLACE(@string, 'ヤ', 'ヤ'); SET @string = REPLACE(@string, 'ユ', 'ユ'); SET @string = REPLACE(@string, 'ヨ', 'ヨ'); SET @string = REPLACE(@string, 'ラ', 'ラ'); SET @string = REPLACE(@string, 'リ', 'リ'); SET @string = REPLACE(@string, 'ル', 'ル'); SET @string = REPLACE(@string, 'レ', 'レ'); SET @string = REPLACE(@string, 'ロ', 'ロ'); SET @string = REPLACE(@string, 'ワ', 'ワ'); SET @string = REPLACE(@string, 'ヲ', 'ヲ'); SET @string = REPLACE(@string, 'ン', 'ン'); -- 小文字 SET @string = REPLACE(@string, 'ァ', 'ァ'); SET @string = REPLACE(@string, 'ィ', 'ィ'); SET @string = REPLACE(@string, 'ゥ', 'ゥ'); SET @string = REPLACE(@string, 'ェ', 'ェ'); SET @string = REPLACE(@string, 'ォ', 'ォ'); SET @string = REPLACE(@string, 'ッ', 'ッ'); SET @string = REPLACE(@string, 'ャ', 'ャ'); SET @string = REPLACE(@string, 'ュ', 'ュ'); SET @string = REPLACE(@string, 'ョ', 'ョ'); SET @string = REPLACE(@string, 'ヶ', 'ケ'); SET @string = REPLACE(@string, 'ヵ', 'カ'); /* 数字 */ SET @string = REPLACE(@string, '0', '0'); SET @string = REPLACE(@string, '1', '1'); SET @string = REPLACE(@string, '2', '2'); SET @string = REPLACE(@string, '3', '3'); SET @string = REPLACE(@string, '4', '4'); SET @string = REPLACE(@string, '5', '5'); SET @string = REPLACE(@string, '6', '6'); SET @string = REPLACE(@string, '7', '7'); SET @string = REPLACE(@string, '8', '8'); SET @string = REPLACE(@string, '9', '9'); SELECT @string; |
半角から全角へ変換
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
-- 変換する文字列 DECLARE @string nvarchar(4000); SET @string = N'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&''()ー-=^~\|`[{+;*:]},<.>/?_* ヴガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンァィゥェォッャュョケカ0123456789'; /* 小文字アルファベット */ SET @string = REPLACE(@string, 'a', 'a'); SET @string = REPLACE(@string, 'b', 'b'); SET @string = REPLACE(@string, 'c', 'c'); SET @string = REPLACE(@string, 'd', 'd'); SET @string = REPLACE(@string, 'e', 'e'); SET @string = REPLACE(@string, 'f', 'f'); SET @string = REPLACE(@string, 'g', 'g'); SET @string = REPLACE(@string, 'h', 'h'); SET @string = REPLACE(@string, 'i', 'i'); SET @string = REPLACE(@string, 'j', 'j'); SET @string = REPLACE(@string, 'k', 'k'); SET @string = REPLACE(@string, 'l', 'l'); SET @string = REPLACE(@string, 'm', 'm'); SET @string = REPLACE(@string, 'n', 'n'); SET @string = REPLACE(@string, 'o', 'o'); SET @string = REPLACE(@string, 'p', 'p'); SET @string = REPLACE(@string, 'q', 'q'); SET @string = REPLACE(@string, 'r', 'r'); SET @string = REPLACE(@string, 's', 's'); SET @string = REPLACE(@string, 't', 't'); SET @string = REPLACE(@string, 'u', 'u'); SET @string = REPLACE(@string, 'v', 'v'); SET @string = REPLACE(@string, 'w', 'w'); SET @string = REPLACE(@string, 'x', 'x'); SET @string = REPLACE(@string, 'y', 'y'); SET @string = REPLACE(@string, 'z', 'z'); /* 大文字アルファベット */ SET @string = REPLACE(@string, 'A', 'A'); SET @string = REPLACE(@string, 'B', 'B'); SET @string = REPLACE(@string, 'C', 'C'); SET @string = REPLACE(@string, 'D', 'D'); SET @string = REPLACE(@string, 'E', 'E'); SET @string = REPLACE(@string, 'F', 'F'); SET @string = REPLACE(@string, 'G', 'G'); SET @string = REPLACE(@string, 'H', 'H'); SET @string = REPLACE(@string, 'I', 'I'); SET @string = REPLACE(@string, 'J', 'J'); SET @string = REPLACE(@string, 'K', 'K'); SET @string = REPLACE(@string, 'L', 'L'); SET @string = REPLACE(@string, 'M', 'M'); SET @string = REPLACE(@string, 'N', 'N'); SET @string = REPLACE(@string, 'O', 'O'); SET @string = REPLACE(@string, 'P', 'P'); SET @string = REPLACE(@string, 'Q', 'Q'); SET @string = REPLACE(@string, 'R', 'R'); SET @string = REPLACE(@string, 'S', 'S'); SET @string = REPLACE(@string, 'T', 'T'); SET @string = REPLACE(@string, 'U', 'U'); SET @string = REPLACE(@string, 'V', 'V'); SET @string = REPLACE(@string, 'W', 'W'); SET @string = REPLACE(@string, 'X', 'X'); SET @string = REPLACE(@string, 'Y', 'Y'); SET @string = REPLACE(@string, 'Z', 'Z'); /* 記号など */ SET @string = REPLACE(@string, '!', '!'); SET @string = REPLACE(@string, '"', '”'); -- SET @string = REPLACE(@string, '"', '“'); SET @string = REPLACE(@string, '#', '#'); SET @string = REPLACE(@string, '$', '$'); SET @string = REPLACE(@string, '%', '%'); SET @string = REPLACE(@string, '&', '&'); SET @string = REPLACE(@string, '''', '’'); SET @string = REPLACE(@string, '(', '('); SET @string = REPLACE(@string, ')', ')'); SET @string = REPLACE(@string, 'ー', 'ー'); SET @string = REPLACE(@string, '-', '-'); SET @string = REPLACE(@string, '=', '='); SET @string = REPLACE(@string, '^', '^'); SET @string = REPLACE(@string, '~', '~'); SET @string = REPLACE(@string, '\', '¥'); SET @string = REPLACE(@string, '|', '|'); SET @string = REPLACE(@string, '`', '‘'); SET @string = REPLACE(@string, '[', '「'); -- SET @string = REPLACE(@string, '[', '['); SET @string = REPLACE(@string, '{', '{'); SET @string = REPLACE(@string, '+', '+'); SET @string = REPLACE(@string, ';', ';'); SET @string = REPLACE(@string, '*', '*'); SET @string = REPLACE(@string, ':', ':'); SET @string = REPLACE(@string, ']', '」'); -- SET @string = REPLACE(@string, ']', ']'); SET @string = REPLACE(@string, '}', '}'); SET @string = REPLACE(@string, ',', '、'); -- SET @string = REPLACE(@string, ',', ','); SET @string = REPLACE(@string, '<', '<'); SET @string = REPLACE(@string, '.', '。'); -- SET @string = REPLACE(@string, '.', '.'); SET @string = REPLACE(@string, '>', '>'); SET @string = REPLACE(@string, '/', '/'); -- SET @string = REPLACE(@string, '/', '・'); SET @string = REPLACE(@string, '?', '?'); SET @string = REPLACE(@string, '_', '_'); SET @string = REPLACE(@string, '*', '×'); -- SET @string = REPLACE(@string, '/', '÷'); SET @string = REPLACE(@string, ' ', ' '); -- SET @string = REPLACE(@string, '(', '〈'); -- SET @string = REPLACE(@string, '[', '【'); -- SET @string = REPLACE(@string, '[', '『'); -- SET @string = REPLACE(@string, '[', '〔'); -- SET @string = REPLACE(@string, '<<', '≪'); -- SET @string = REPLACE(@string, '((', '《'); -- SET @string = REPLACE(@string, ')', '〉'); -- SET @string = REPLACE(@string, ']', '】'); -- SET @string = REPLACE(@string, ']', '』'); -- SET @string = REPLACE(@string, ']', '〕'); -- SET @string = REPLACE(@string, '>>', '≫'); -- SET @string = REPLACE(@string, '))', '》'); /* カタカナ */ -- 濁音、半濁音(全角1文字へ変換) SET @string = REPLACE(@string, 'ヴ', 'ヴ'); SET @string = REPLACE(@string, 'ガ', 'ガ'); SET @string = REPLACE(@string, 'ギ', 'ギ'); SET @string = REPLACE(@string, 'グ', 'グ'); SET @string = REPLACE(@string, 'ゲ', 'ゲ'); SET @string = REPLACE(@string, 'ゴ', 'ゴ'); SET @string = REPLACE(@string, 'ザ', 'ザ'); SET @string = REPLACE(@string, 'ジ', 'ジ'); SET @string = REPLACE(@string, 'ズ', 'ズ'); SET @string = REPLACE(@string, 'ゼ', 'ゼ'); SET @string = REPLACE(@string, 'ゾ', 'ゾ'); SET @string = REPLACE(@string, 'ダ', 'ダ'); SET @string = REPLACE(@string, 'ヂ', 'ヂ'); SET @string = REPLACE(@string, 'ヅ', 'ヅ'); SET @string = REPLACE(@string, 'デ', 'デ'); SET @string = REPLACE(@string, 'ド', 'ド'); SET @string = REPLACE(@string, 'バ', 'バ'); SET @string = REPLACE(@string, 'ビ', 'ビ'); SET @string = REPLACE(@string, 'ブ', 'ブ'); SET @string = REPLACE(@string, 'ベ', 'ベ'); SET @string = REPLACE(@string, 'ボ', 'ボ'); SET @string = REPLACE(@string, 'パ', 'パ'); SET @string = REPLACE(@string, 'ピ', 'ピ'); SET @string = REPLACE(@string, 'プ', 'プ'); SET @string = REPLACE(@string, 'ペ', 'ペ'); SET @string = REPLACE(@string, 'ポ', 'ポ'); -- 通常 SET @string = REPLACE(@string, 'ア', 'ア'); SET @string = REPLACE(@string, 'イ', 'イ'); SET @string = REPLACE(@string, 'ウ', 'ウ'); SET @string = REPLACE(@string, 'エ', 'エ'); SET @string = REPLACE(@string, 'オ', 'オ'); SET @string = REPLACE(@string, 'カ', 'カ'); SET @string = REPLACE(@string, 'キ', 'キ'); SET @string = REPLACE(@string, 'ク', 'ク'); SET @string = REPLACE(@string, 'ケ', 'ケ'); SET @string = REPLACE(@string, 'コ', 'コ'); SET @string = REPLACE(@string, 'サ', 'サ'); SET @string = REPLACE(@string, 'シ', 'シ'); SET @string = REPLACE(@string, 'ス', 'ス'); SET @string = REPLACE(@string, 'セ', 'セ'); SET @string = REPLACE(@string, 'ソ', 'ソ'); SET @string = REPLACE(@string, 'タ', 'タ'); SET @string = REPLACE(@string, 'チ', 'チ'); SET @string = REPLACE(@string, 'ツ', 'ツ'); SET @string = REPLACE(@string, 'テ', 'テ'); SET @string = REPLACE(@string, 'ト', 'ト'); SET @string = REPLACE(@string, 'ナ', 'ナ'); SET @string = REPLACE(@string, 'ニ', 'ニ'); SET @string = REPLACE(@string, 'ヌ', 'ヌ'); SET @string = REPLACE(@string, 'ネ', 'ネ'); SET @string = REPLACE(@string, 'ノ', 'ノ'); SET @string = REPLACE(@string, 'ハ', 'ハ'); SET @string = REPLACE(@string, 'ヒ', 'ヒ'); SET @string = REPLACE(@string, 'フ', 'フ'); SET @string = REPLACE(@string, 'ヘ', 'ヘ'); SET @string = REPLACE(@string, 'ホ', 'ホ'); SET @string = REPLACE(@string, 'マ', 'マ'); SET @string = REPLACE(@string, 'ミ', 'ミ'); SET @string = REPLACE(@string, 'ム', 'ム'); SET @string = REPLACE(@string, 'メ', 'メ'); SET @string = REPLACE(@string, 'モ', 'モ'); SET @string = REPLACE(@string, 'ヤ', 'ヤ'); SET @string = REPLACE(@string, 'ユ', 'ユ'); SET @string = REPLACE(@string, 'ヨ', 'ヨ'); SET @string = REPLACE(@string, 'ラ', 'ラ'); SET @string = REPLACE(@string, 'リ', 'リ'); SET @string = REPLACE(@string, 'ル', 'ル'); SET @string = REPLACE(@string, 'レ', 'レ'); SET @string = REPLACE(@string, 'ロ', 'ロ'); SET @string = REPLACE(@string, 'ワ', 'ワ'); SET @string = REPLACE(@string, 'ヲ', 'ヲ'); SET @string = REPLACE(@string, 'ン', 'ン'); -- 小文字 SET @string = REPLACE(@string, 'ァ', 'ァ'); SET @string = REPLACE(@string, 'ィ', 'ィ'); SET @string = REPLACE(@string, 'ゥ', 'ゥ'); SET @string = REPLACE(@string, 'ェ', 'ェ'); SET @string = REPLACE(@string, 'ォ', 'ォ'); SET @string = REPLACE(@string, 'ッ', 'ッ'); SET @string = REPLACE(@string, 'ャ', 'ャ'); SET @string = REPLACE(@string, 'ュ', 'ュ'); SET @string = REPLACE(@string, 'ョ', 'ョ'); -- SET @string = REPLACE(@string, 'ケ', 'ヶ'); -- SET @string = REPLACE(@string, 'カ', 'ヵ'); /* 数字 */ SET @string = REPLACE(@string, '0', '0'); SET @string = REPLACE(@string, '1', '1'); SET @string = REPLACE(@string, '2', '2'); SET @string = REPLACE(@string, '3', '3'); SET @string = REPLACE(@string, '4', '4'); SET @string = REPLACE(@string, '5', '5'); SET @string = REPLACE(@string, '6', '6'); SET @string = REPLACE(@string, '7', '7'); SET @string = REPLACE(@string, '8', '8'); SET @string = REPLACE(@string, '9', '9'); SELECT @string; |