Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSMS: When selecting a string in script highlight same literals

Tags:

ssms

In Visual Studio when I select any literal it will highlight all the occurrences of the same literal. Is there a similar functionality in SQL Server Management Studio.

Say I have My_Temp_Table in my script. When selecting the literal "My_Temp_Table" I would like SSMS to highlight every instance of the "My_Temp_Table" string in my script.

like image 966
PiotrWolkowski Avatar asked Feb 26 '15 14:02

PiotrWolkowski


2 Answers

No, there's no such feature on SSMS.

I tried to look for the same feature as well. CTRL + F is our only good options to look for the same name literals.

like image 110
Willy David Jr Avatar answered Nov 11 '22 18:11

Willy David Jr


I've not yet found any such setting (and it's something I really miss whenever I switch from Visual Studio to SSMS), but I've stumbled across a few shortcuts on the Microsoft doc that expand on the answer by @willy-david-jr:

  • Display the Find dialog box: CTRL+F
  • Find the next occurrence of the previous search text: F3
  • Find the previous occurrence of the search text: SHIFT+F3
  • Find the next occurrence of the currently selected text: CTRL+F3
  • Find the previous occurrence of the currently selected text: CTRL+SHIFT+F3

Using these in conjunction with cursor position, you can at least more easily cycle through occurrences of the literal in the current editor window. They all highlight matches, and you don't even need to double-click the literal you want to search - simply having the caret in the string when you press the shortcut is sufficient.

like image 35
Myles Avatar answered Nov 11 '22 18:11

Myles