Is there a way to define the names of the result tabs names in an SQL Script in DBeaver?
Asked Answered
R

1

16

I'm creating a MySQL Script that runs on a record and pulls associated records from a series of other tables, which is super useful but in DBeaver the results come back as tabs that only have the name of the table the results come from, which is very useful but sometimes having the tab display exactly what the result is would be so much more useful.

Is there a way to specify in the SQL script what the result should be named that is picked up by DBeaver so it gets displayed as the tab name?

In DBeaver, if I execute the following script (Opt+X):

SELECT *
FROM
  partnerships;

SELECT id, name, owner_id
FROM
  partnerships
WHERE
  name LIKE '%wp%';

The results for both queries come up in two different tabs at the bottom of the DBeaver screen, one would be named partnerships and the other partnerships-1. What I'm asking is, if there is a way to make those tabs something more meaningful to me, like All Partnerships and WP Partnerships.

Reareace answered 2/11, 2017 at 17:59 Comment(3)
It's not clear what you are asking here. Consider posting a minimal example of what you've tried and a description of the actual results and how they differ from what you're trying to achieve.Philately
did you try select * from partnerships as Some_other_name_here?Rodroda
Yes, that unfortunately did not work, DBeaver just comes back saying there's an error in the SQL.Reareace
R
35

Turns out, you can actually define the title with a SQL comment in front of the query. Such as:

-- title: WP Named Partnerships
SELECT id, name, owner_id
FROM
  partnerships
WHERE
  name LIKE '%wp%';

This will make it so that WP Named Partnerships will be the title of the results tab.

Reareace answered 3/11, 2017 at 23:49 Comment(2)
that is the title, any other options to disable creating tabs for selects? i want to show the last select results onlyMccully
It doesn't work for me on MySQL Workbench 8.0.22 Community on Mac.Trousers

© 2022 - 2025 — McMap. All rights reserved.