Wednesday, March 7, 2012

How to use CTRL+SHIFT+INSERT to insert template in Management Stud

Hi,
I am trying to create a simple template in Managament Studio editor that has
"Select * from " and try to invoke it by keyboard short cut so that I don't
have to type this everytime I want to type in "Select * from ". Anyone who
has done this kinda thing?
Thanks for the help!
-JoshHi
Having SELECT * FROM in production code is not recommended therefore the
need to do this would only be in ad-hoc queries or possibly EXIST clauses,
therfore the need to do this may not be as great as you expect, expecially a
s
it is not saving that much typing.
You can assign keys in management studio to run procedures, but not to
insert text. What you may want to look at is the ability to create SELECT
statements from the object explorer (F8) by right clicking the stored
procedure and using the script option to script a select statement to file,
window or the clipboard. Also if you want to insert object names into a
window the object can be dragged across from the object explorer and the nam
e
will be inserted. If you drag the columns branch of a table across you will
get a list of all columns.
You can also create your own templates (see the template explort CTRL+ALT+T)
if you have more complex code needs (such as a stored procedure with standar
d
error handling block). Templates can contain substitute values such as
SELECT * FROM <schema_name, sysname, dbo>.<table_name, sysname, sample_table
>
John
"Kodi" wrote:

> Hi,
> I am trying to create a simple template in Managament Studio editor that h
as
> "Select * from " and try to invoke it by keyboard short cut so that I don'
t
> have to type this everytime I want to type in "Select * from ". Anyone who
> has done this kinda thing?
> Thanks for the help!
> -Josh

No comments:

Post a Comment