[This topic is migrated from our old forums. The original author name has been removed]
I'm thinking something like this would be very useful in scripts:
bq. @RENAMETAB next="Customers" \\ select top 100 * from customers -- Tab heading gets renamed to "Customers" \\ select top 100 * from orders -- Tab heading stays as default \\ \\ @RENAMETAB all="Addresses" \\ select top 100 * from delivery_addresses -- Tab heading gets renamed to "Addresses" \\ select top 100 * from billing_addresses -- Tab heading stays renamed as "Addresses" \\ \\ @RENAMETAB -- Empty command resets all tab headings back to defaults
Hope that makes sense.
Regards,
Vince
Hi Vince,
Thanks for the suggestion. We already have this on our list but I have added your vote for the feature.
Best Regards,
Hans
Roger Bjärevall
said
over 9 years ago
[This reply is migrated from our old forums.]
Re: Client side command to rename tabs
Vince,
DbVisualizer 9.2 has just been released with support to set the name of next result set,
http://www.dbvis.com/doc/relnotes/?version=9.2&showtoc=false
Regards
Roger
a
anonymous
said
almost 9 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: Client side command to rename tabs
Hi Roger,
Thanks, I'd hoped to apply this technique to my existing scripts and it is almost perfect except that I'm running multi-statement SQL Server scripts that refer to variables (and table variables). This means I must execute the statement as a single query batch otherwise the variables are no longer in scope.
As a simplified example, this fails with the error "Must declare the scalar variable @myvar":
declare @myvar varchar(50) = 'lalala'
GO
@set resultset name blah
GO
select @myvar
The documentation shows the use of semicolons instead of GO delimiters but I have semicolon delimiters turned off in the options as I want semicolons to be statement delimiters and GO to be a batch delimiter. If I add semicolons as delimiters then many scripts fail to run as they are treated as multi-batch scripts causing variable scoping issues again.
Does the @set command have to work on the next query batch? Could it instead rename tabs based on the number of grids returned regardless of whether they're in a new batch or not?
In other words, I'd ideally like to be able to use:
declare @myvar varchar(50) = 'lalala'
@set resultset name blah
select @myvar
Regards,
Vince
Roger Bjärevall
said
almost 9 years ago
[This reply is migrated from our old forums.]
Re: Client side command to rename tabs
Hi Vince,
If you run this it will rename the result set for the next result set(s):
@set resultset name blah
GO
declare @myvar varchar(50) = 'lalala'
select @myvar
The "@set resultset name" command will rename all following result sets with the name + an index.
It is not possible to embed @ in statement block supposed to be executed by the DB server. The reason is that all @ are extracted and processed by DbVisualizer before any SQLs are sent to the server.
Regards
Roger
anonymous