Little Things That Count: Copying Names in Management Studio

This post is about a really little detail that isn’t a big deal.

But to me it actually is a little bit of a big deal. Or would that be a little deal that just really adds up over time?  Either way, this is the most fun, trivial-but-helpful-and-fun-in-a-weird-way thing I’ve learned about SQL Server Management Studio in a long time. Maybe a lot of people know this already?

So here’s the revelation (a very small drumroll, please)…

In management studio, you just have to highlight an object name and use ctrl-c to copy the object name.

You don’t have to use F2 to edit the object name like you do in Windows Explorer (or double click).

Here’s the add on to the revelation (an even smaller drumroll, please)…

This also works with multi-select in the object explorer details window. More information about the Object Explorer Details pane are here on Technet.

Ta Da!

OK, so here’s why this matters to me.  First, it saves me time and anxiety. For years, I’ve been using F2 to get the cursor to go over the object name, then copying the name, getting nervous because I absolutely do NOT want to change the name, and then hitting escape really fast to make sure I don’t change anything. Because this whole process creeps me out (because I REALLY don’t want to change any object names in my application databases by accident). To avoid this whole issue, usually I just retype the name of whatever the object is. And some of our objects have really long names which are quite similar.

Second, it’s just really handy with the multi-select option in Object Explorer Details. Today I needed to look at a list of logins in production and create a list of how they relate to a list of logins in another domain. It was so simple, I just opened the object explorer details pane for the logins, highlighted all umpteen logins I wanted, and pasted them into Excel.

Why Didn’t I Figure This Out Before???

I know why I never knew this: it’s because when you have an item highlighted and right click in Management Studio, there is no ‘Copy’ or ‘Copy to Clipboard’ option. Maybe this is because they didn’t want people to think that somehow the whole table or login or object itself would be sucked into the Windows Clipboard? I’m not sure, but I’m guessing this is what kept me in the dark for so long.

Bonus Fun Little Trick

The bonus trick is that to use sp_configure, you don’t have to specify the entire name of the option. So for example, to show the value of ‘max degree of parallelism’, you can just run:

sp_configure degree

This also works for setting values, so make sure you’re setting the value you really want to set. SQL Server will print out the full name of the option you are configuring after it runs, so you can read that for reassurance before you reconfigure.

This last tidbit is filed under “Things Gail Shaw mentioned that people Tweeted” :)

Photo attribution: / CC BY 2.0