I have a recent MariaDB Server (10.3.23-MariaDB-1:10.3.23+maria~focal mariadb.org binary distribution) on Ubuntu 20.04 which cuts off text. Simple see the following gist: https://gist.github.com/ThomasChr/ed8c2a8405947a8af0cda039bd2c3f0a
Selecting the text with a simple SELECT returns all ~100586 Bytes. Selecting the same text with a simple select before (or after) with UNION ALL (or only UNION) gives me only 34797.
I couldn't find any mentions in the Webs of this behavior nor could I find any variables on my server which seem to be responsible for that. Any ideads what I'm missng?
Related
I created a SQL query that counts the number of servers running test jobs on a specific Jenkins server at a specified time. I'm trying to chart it on Grafana but for some reason, it's displaying the value as NaN.
The data source is a MySQL server. I'm running Grafana version 8.1.5. I went on the server (phpMyAdmin) to check the results of the query and I can see numbers.
When we look at the grafana chart/panel, the bars on the chart look like it matches the values, but the chart shows NaN instead of the value.
What setting do I need to change so that it can print the numeric value on the chart instead of displaying NaN?
EDIT: Looks like I didn't include enough info to my question.
Here's the query that's used, although, I don't know how feasible it is to include the tables with data to demo the issue:
SELECT COUNT(DISTINCT(tb_name)) as val, jenkins FROM (
SELECT
hw.collected_date AS mytime,
hw.jenkins AS jenkins,
hw.name AS tb_name
FROM hw_report as hw LEFT OUTER JOIN jenkins_owner jo
ON hw.jenkins = jo.jenkins
WHERE jo.org IN ('Enterprise Readiness')) as y
WHERE mytime = '2021-12-03 00:00:00'
GROUP BY jenkins
HAVING count(distinct(tb_name)) > '0'
Here are screenshots of my panel. The "Show values" setting is set to "Always", which II assume should show the values.
One thing I noticed is when I hover over the bar, it shows
COUNT(DISTINCT(name_cnt))
instead of a numeric value. Not sure if this is indicative of anything. I checked other charts in the dashboard that someone created and their bars either have a numeric value or it's just a column name (like name_cnt)
Sorry I'm a noob and didn't know what to configure, look up, or mention in my question. I accidentally came across the answer.
So it seems like I need to select something under the "Transform" tab for the panel. Calculation needs to be "Total" instead of "Count" and I need to hide the fields specified in my SQL query and show the "Total"
SELECT TO_CHAR(76543210.98, '999G999G990D00');
This line code works well in pgadmin4, and psql.
But
It convert the numeric to text, obviously that's not i want.
Is there any possible way to change the configure settings.
So that pgadmin4 will automatically display the thousand separator.
is there a way to limit the number of rows while exporting or imported data in DBeaver?
In my case I have a remote DB2 and I need to import SOME rows of a specific table into a local MySQL DB that I have.
Is there a way to do that?
Thanks
Limiting the number of rows being exported only makes sense if the export wizard knows what rows (e.g. order) to export. Therefore it only makes sense to export the resultset of a query, as opposed to export the actual table with a limiting factor.
This is how you can do this in DBeaver:
Issue a query like SELECT * FROM my_table ORDER BY mycolumn LIMIT n.
Replace n with any integer you like obviously. You may also add
DESC after mycolumn, if only the most recent rows make sense to you.
Run the query.
In the pane with the resultset, locate the button
tooltipped "Export result set to fil or another table". It looks
like a tray with an upward arrow. In DBeaver 7.2.2, it is just left
of the split number and cog buttons.
Run that wizard, selecting "SQL" target type (Export to SQL INSERT statements)
Click Next, and configure any other export preferences (you may leave default too).
The file being exported should content you.
I am having difficulty with my decimal columns. I have defined a view in which I convert my decimal values like this
E.g.
SELECT CONVERT(decimal(8,2), [ps_index]) AS PriceSensitivityIndex
When I query my view, the numbers appear correctly on the results window e.g. 0,50, 0,35.
However, when I export my view to file using Tasks > Export Data ... feature of SSMS, the decimals lower than zero appear as ,5, ,35.
How can I get the same output as in the results window?
Change your query to this:
SELECT CAST( CONVERT(decimal(8,2), [ps_index]) AS VARCHAR( 20 ) ) AS PriceSensitivityIndex
Not sure why, but bcp is dropping leading zero. My guess is it's either because of the transition from SQL Storage to a text file. Similar to how the "empty string" and nulls are exchanged on BCP in or out. Or there is some deeper config (windows, sql server, ?) where a SQL Server config differs from an OS config? Not sure yet. But since you are going to text/character data anyway when you BCP to a text file, it's safe (and likely better in most cases) to first cast/convert your data to a character data type.
You know in SQL Developer, let's say a query returned 100 rows. Of those 100 rows you could ctrl shift and highlight just a portion of them then right click on that highlighted section and click count to get a total of the highlighted section. Any way to do that in MySQL Workbench?
On a side note, I can't believe they don't allow line numbering in the results section. It'd be a HUGE help.
Is there no way you could get your query to give you the rows that you are selecting. If you can do it manually I'm pretty sure you can run a query to return the results.
Is there any reason you have to use MySQL Workbench ?
for example HeidiSQL counts the rows you are selecting
When I first installed Mysql, mysql workbench was installed with it but I wasn't convinced, so I installed HeidiSQL and I'm fully satisfied.