Hi, my name is Olga, and I'm a content developer in Toad for SQL Server team. In this video, I'll give you some tips and tricks how you can explore large scripts with a Script Map. I will also show you how you can easily browse and navigate through your scripts using the Script Map feature.
I've got a test script prepared in the editor. It's quite long and complicated. It includes number of DDL statements, as well as DML, such as inserts, drops, creates, selects, also subqueries, declarations and many, many others. So when working with such scripts it's difficult to jump between the statements every now and then, and scroll the scripts up and down. So the script map can be real help for me.
The script mapping provides [? full ?] structures and clear representation of the scripts in the editor. And allows to easily manipulate statements and statements groups. By default the script map is switched on. But you can also invoke it with Editor, Windows, Script Map.
Now the script map is empty, so to fill it I click the Refresh button. Now we can see the script structure. Script map supports most of SQL statements and recognizes nesting levels, for example, decode blocks named regions, and others.
For example, the nesting is the [INAUDIBLE] assorted procedures and functions. What's more, I can collapse and expand high level structure, such as batches and blocks. The search pane provides me with search functionality, so I can find my statements and objects way faster.
At the same time I can customize which exactly statements I want to see. For example, I'm interested in the critical statements only. So I go to Options, and clear the other statements. So I have only inserts, deletes, and drops here. So here we go. And I can restore to defaults with a single click.
I can quickly navigate to the queries I'm interested in with a double-click. Or I can right-click a statement and select an action from the context menu. For example , I can select Go To, Cut, Select, turn into Comment, or Surround With [? snippet. ?] At the same time, when I alter the scripts in the editor, the script map continues to reflect the previous state of the script. So please make sure to update it every time you delete or edit statements in the editor.
Also Script Map allows to manage scripts as separate queries. You can select one of several items in the script map pane. Right-click them and select execute. Only these statements will be executed in the script.
Script Map can be helpful for quick reviewing of script. For example, I have a mistake here. So when I refresh this script map I can see that some items are underlined red. It means that there's something wrong. The batch is also underlined red, so in case I collapse it, I'll still be able to see that I have something to fix there.
When I hover a mouse over the incorrect statements, I can see the [INAUDIBLE], so I can easily fix it.
To learn more about Toad for SQL Server visit Quest.com/Toad-For-SQL-Server and join community at ToadforSQLServer.com
Thank you for attention and goodbye.