Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any shortcut to preview procedure/function definition

I once saw a professional guy doing this: in a normal SQL query window, select any procedure/function name, and stroke a key combination, then the definition of this object is right there in query result grid, then he can just copy the resulting text to an editor to review it.

I'm regretting not asking him, so I'm asking here right now, hopefully, someone would know how to do that, thanks!

BTW, he was using SQL Server Management Studio, don't know which version.

like image 434
Yufeng Guo Avatar asked Sep 01 '25 11:09

Yufeng Guo


2 Answers

Are you looking for sp_helptext ?

sp_helptext 'procedure/function name'

And then just press F5 to view destination of procedure/function name in query result grid.

If you want to see OBJECT schema then use alt + f1 combination.

like image 134
Yogesh Sharma Avatar answered Sep 04 '25 00:09

Yogesh Sharma


Redgate SQLPrompt, a third party plugin for SSMS, has also similar functionality. When mouse cursor is on top of any object a pop-up window appears with a definition of the object:

enter image description here

like image 44
Alexander Volok Avatar answered Sep 04 '25 00:09

Alexander Volok