Scrolling gets old really fast
The splitter bar, GOTO, and quick find keep you from losing your place in a large script.
When you’re editing longer scripts, it can be super useful to see multiple zones of the script at once. You may even want to edit multiple parts of the script at once.
This is possible through a feature called the splitter bar
The splitter bar is actually a [Microsoft] Office feature, we just also have it in Management Studio.
Over at the top right of our window, we’ve got this thing that looks like a pipe sort of with two arrows. This is the magical splitter bar. It’s subtle, but once you see it, you know it’s there. What I’m going to do is I’m going to grab this thing, and I’m going to drag it down. It defaults to showing where I currently am in the script in both the top pane and the bottom pane.
But let’s see in the top pane I want to go to line one.
Control + g - Go To
I want to go to the top of the script, so I’m going to do control + g for Go To, and then just do line one. So now I’m at the top of the script in the top pane. I can edit this here. I can type, I can save, this is all the same script, I’m just looking at the top of the script and the middle of the script at once.
Maintaining position when closing the splitter bar
When I close the splitter bar, which I can do at any time by just dragging it up, I want to click on the place where I want to remain before I close it. In other words, if I was to click here at this RAISERROR and then close the splitter bar, it would leave me back at the top of the script, because that’s where I am in this top pane.
But I want to stay in the middle of the script, so I’m going to click here on close the splitter bar.
You don’t have to highlight, I just did, and then close it, and it leaves me at that place in the script.
Control + i - Quick find
I can even use features like find in both panes, which is really cool. I’m going to reopen my splitter bar by dragging it down, and now in the top bar, I’m going to do control + i. I like control + i, because it brings up quick find, which is super simple to use. It doesn’t have a ton of options on it, no regular expressions, no nothing. I want to find all instances of the word ‘lose’.
The first instance, I can’t quite see it on the screen, so I’m going to hit control + i again to say, okay, bring the next instance up to me. Okay, there’s one instance.
I do control + i again, it finds ‘lose’ in the word ‘close’. Do control + i again, I’m at ‘close the splitter bar’. I can iterate through these and stop wherever I want. Esc makes the find go away. Similarly, in the bottom pane, I can do control + i, and I get a find in the bottom pane. They’re independent.
Here I want to find the word ‘quick’. Note that it’s finding, even though I did ‘quick’, I didn’t have to do anything special to find quick with upper case. And same thing, control + i will iterate through them until I am where I want.
And I find that control + i really, really easy to use. The splitter bar and being able to edit in both panes, as well as being able to use tools like quick find, , or find and replace, , really super flexible and makes working with long scripts much, much easier.