I'm trying to use mysql workbench as a query editor for my project. My output in the results viewer looks like this:
Even if I set varbinary/binary characters to show up as non-binary I still get this output. And it is for all fields whether they be text, int, date, etc.
Can anyone help?
You must choose "Query" - "Execute (All or Selection) to text" in the up menu
PL/SQL Developer is showing number results like 9.15734383345614E18.
What config change is needed to show number result in text format?
Try to convert it to char:
select F1 , to_char(F1) from T1;
or simply go to this path and do the config in PL/SQL Developer:
Configure -> Preferences -> SQL Window -> Number fields to_char
I am executing a simple select query in mysql. When I view the values using phpMyAdmin, everything looks normal. But once I execute a select query in terminal.. Irregular characters like these show.
��S8"�����g��n��Q�5��S:���p/��F;X�.�g����W�=��r+:��J�3W
\��S�R��CΤS�4�9�#�5���lˠ��bc�Q�}Q��(8>Vm���0�RU6L�FO#�W����W�SR>~�9$�-Q[XȲ�z�L�T�j �~���#˔{���ZQUX�ǑZ:L&[�־[-�>z)5�A�ּd 9��H����^��w��xq&���kK��ʺs��R*-�3�Z����� ��#i ����;��C
�־������
The phpMyAdmin interface can handle unicode - your terminal cannot
Several times when troubleshooting my SQL queries, I run into a problem where there is extra space in one of my columns which breaks a comparison. Because SSMS 2008 auto-trims those columns, I don't see the problem. It makes troubleshooting take much longer.
Is there any way to disable this auto-trimming?
I don't know of a way to do this through the SSMS options, but I discovered a workaround: it appears that SSMS does not autotrim if all values in the column are of a string type. For instance, the following will display with ten spaces in front of the numeric value:
select
space(10) + cast(2000 as varchar)
as PaddedValue
Without the cast, the spaces do not appear in the results grid:
select
space(10) + 2000
as TrimmedValue
I'm using MySQL Workbench CE 5.2.30 CE / Rev 6790 . When execute the following statement:
SELECT OLD_PASSWORD("test")
I only get back a nice BLOB icon, I need to left-click to select the cell, right-click and choose "Open Value in viewer" and select the "Text" tab.
Using the same with phpMyAdmin, I get directly back the value of the OLD_PASSWORD call. It's just an example, but is there a way to directly see such results in the output?
In short:
Go to Edit > Preferences
Choose SQL Editor
Under SQL Execution, check Treat BINARY/VARBINARY as nonbinary character string
Restart MySQL Workbench (you will not be prompted or informed of this requirement).
In MySQL Workbench 6.0+
Go to Edit > Preferences
Choose SQL Queries
Under Query Results, check Treat BINARY/VARBINARY as nonbinary character string
It's not mandatory to restart MySQL Workbench (you will not be prompted or informed of this requirement).*
With this setting you will be able to concatenate fields without getting blobs.
I think this applies to versions 5.2.22 and later and is the result of this MySQL bug.
Disclaimer: I don't know what the downside of this setting is - maybe when you are selecting BINARY/VARBINARY values you will see it as plain text which may be misleading and/or maybe it will hinder performance if they are large enough?
I'm not sure if this answers the question but if if you right click on the "blob" icon in the field (when viewing the table) there is an option to "Open Value in Editor". One of the tabs lets you view the blob. This is in ver. 5.2.34
Perform three steps:
Go to "WorkBench Preferences" --> Choose "SQL Editor" Under "Query Results": check "Treat BINARY/VARBINARY as nonbinary character string"
Restart MySQL WorkBench.
Now select SELECT SUBSTRING(<BLOB_COLUMN_NAME>,1,2500) FROM <Table_name>;
casting works, but it is a pain, so I would recommend using spioter's method unless you are using a lot of truly blob data.
SELECT CAST(OLD_PASSWORD("test") AS CHAR)
You can also cast as other types, and even restrict the size, but most of the time I just use CHAR:
http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html#function_cast
select CONVERT((column_name) USING utf8) FROM table;
In my case, Workbench does not work. so i used the above solution to show blob data as text.
Doesn't seem to be possible I'm afraid, its listed as a bug in workbench:
http://bugs.mysql.com/bug.php?id=50692
It would be very useful though!
had the same problem, according to the MySQL documentation, you can select a Substring of a BLOB:
SELECT id, SUBSTRING(comment,1,2000) FROM t
HTH, glissi
I pieced a few of the other posts together, as the workbench 'preferences' fix did not work for me. (WB 6.3)
SELECT CAST(`column` AS CHAR(10000) CHARACTER SET utf8) FROM `table`;
Work bench 6.3
Follow High scoring answer then use UNCOMPRESS()
(In short:
1. Go to Edit > Preferences
2. Choose SQL Editor
3. Under SQL Execution, check Treat BINARY/VARBINARY as nonbinary character string
4. Restart MySQL Workbench (you will not be prompted or informed of this requirement).)
Then
SELECT SUBSTRING(UNCOMPRESS(<COLUMN_NAME>),1,2500) FROM <Table_name>;
or
SELECT CAST(UNCOMPRESS(<COLUMN_NAME>) AS CHAR) FROM <Table_name>;
If you just put UNCOMPRESS(<COLUMN_NAME>) you can right click blob and click "Open Value in Editor".
there is few things that you can do
SELECT GROUP_CONCAT(CAST(name AS CHAR))
FROM product
WHERE id IN (12345,12346,12347)
If you want to order by the query you can order by cast as well like below
SELECT GROUP_CONCAT(name ORDER BY name))
FROM product
WHERE id IN (12345,12346,12347)
as it says on this blog
http://www.kdecom.com/mysql-group-concat-blob-bug-solved/
NOTE: The previous answers here aren't particularly useful if the BLOB is an arbitrary sequence of bytes; e.g. BINARY(16) to store 128-bit GUID or md5 checksum.
In that case, there currently is no editor preference -- though I have submitted a feature request now -- see that request for more detailed explanation.
[Until/unless that feature request is implemented], the solution is HEX function in a query: SELECT HEX(mybinarycolumn) FROM mytable.
An alternative is to use phpMyAdmin instead of MySQL Workbench - there hex is shown by default.