I am digging into more features of Toad and I am trying to figure out Toad Views.
I have saved a couple of queries as views but cannot seem to get them to work when I want to use them. The help text states the following:
To use a Toad View
In the Toad Views Manager, do one of the following:
To add a Toad View to the Editor, double-click or drag the view to the Editor window.
To add a Toad View to a Query Builder, drag the view to the Query Builder Diagram or Query window.
Note: If the active window is not an Editor, double-clicking a view in the Toad Views Manager opens a new Editor window containing the view.
First, I cannot drag the view to an editor window. When I do I get a circle with a line thru it.
I can double click on the view and it will add the name of the view surrounded by two pairs of curly brackets. So I have a Toad View called “Test”. I double click on it and the following get entered into the editor window.
{{Test}}
So what am I supposed to do with this? Is this working? Am I using it wrong?
I am having the exact problem. I expected that when I double-click on the toad view, toad will load the view in the editor. When I click on the Send to Editor it sends {{SimpleQuery}} (SimpleQuery is name of the ToadView) instead of the content.
In my opinion Toad Views is one of those useless features because you can always organize all your scripts properly in folders and then you just open the files. You don’t really need Toad Views. Also, if the Project Manager wasn’t so brain dead (you cannot add specific files) you could achieve the same thing.
It is really disappointing. They can’t get simple features working properly. It’s almost like they are using co-op students to do the development. Do you guys even test this stuff, because it looks like you don’t do it?
Hello,
thank you for the questions. Please refer to the Help and Release Notes documentation on how to use this new feature. Please do not mix up it with Code Snippets - it is different.
Please see my screen attached as a simple example of a feature usage.
I read Alexander’s answer and it seems that I originally didn’t understand how exactly this feature works. It is is a nice feature, however I still think it is in the “fluff” category because one could create sql views to achieve just that. I also pushed it a bit more and I tried to make the Toad View a sql script that returns a dataset using variables. Example:
DECLARE @x INT = 1
SELECT *
FROM (SELECT 1 AS x
UNION ALL
SELECT 2) t
WHERE t.x = 1
if you do this the view breaks apart. It seems that the view simply replaces the {{…}} entry with an inline query.
If SimpleQuery is set to:
SELECT *
FROM (SELECT 1 AS x
UNION ALL
SELECT 2) t
Then running:
select * from {{SimpleQuery}} t union all select * from {{SimpleQuery}}
produced this query:
SELECT *
FROM (SELECT *
FROM (SELECT 1 AS x
UNION ALL
SELECT 2) a5rp0tsfcdfo6mijcce0137d79l2mm) t
UNION ALL
SELECT *
FROM (SELECT *
FROM (SELECT 1 AS x
UNION ALL
SELECT 2) a5rp0tsfcdfo6mijcce0137d79l2mm) flv4kkq4v7u53v7ijtvbk5e4dahbl3
Yes, I see the same transformation in Profiler. But from what I see, provided construction with using {{…}} still valid and returns the data when I execute it.
Am I missing something? Can you please be more specific to see what concerns you in this case?