Help us understand the problem. What is going on with this article?

MySQL上の改行コードを取り除く

More than 1 year has passed since last update.

SELECTしにくいデータ

最近こんなデータを目にしました

  • クエリ
SELECT
  some.`整理番号` 
  , HEX(some.`整理番号`) 
FROM
  tmp.`some_table` some
  • 結果
    • なんか改行コード(=0x0D)が混じっている
整理番号, HEX(some.`整理番号`)
9734601 , 39373334363031200D
9734602 , 39373334363032200D
2747031 , 32373437303331200D

取り除く

  • とりあえず以下で取り除く
  • UNHEX は16進数で文字を指定できる
TRIM( UNHEX('0D') FROM some.`整理番号` )

環境

MySQL Aurora 5.6.10-log

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away