Solved

Best way to use SSMS intellisense when querying

Posted on 2016-10-29
5
60 Views
Last Modified: 2016-11-03
HI,

We  want some tricks on using best way the the Microsoft SQL Server Management Studio Intellisense.  We know that this tool helps one when querying but for some reason it's not working with us.  We would like to:

    - Type 'select' then being ask the table.

    - If we type 'select table-name' and place the cursor after 'select' we would like to be
      displayed a list of column for that table (without haing to place 'table-name C'.

    - or if there some short we can store statements for faster scripting.

    - Finally, any other good practice in time-saving query-typing any EE can help in.[/list]
0
Comment
Question by:rayluvs
  • 3
5 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 41865523
You should be able to type SELECT {return key} FROM {table name}, then click back to the first line after the SELECT, and start typing columns.  Without the FROM clause IntelliSense has no idea what tables is needed to populate the column list.

You may have to change the selected database just in case your SSMS is using something like master as the default.
0
 
LVL 24

Accepted Solution

by:
Pawan Kumar earned 250 total points
ID: 41865592
In addition to What Jim sir has mentioned, if you have a long column list then you can do below-


You can select the table name and drag the columns so that you dont have to type huge list of columns. Drag a comma separated list of all Columns from Object Explorer window to the Query Window.


EE column...
Also some times the IntelliSense does not work- in that case you have refresh the local cache.

EE clear cache.
Another good tip is you can search any object from below.

EE object search

Hope it helps !!
0
 
LVL 24

Assisted Solution

by:Pawan Kumar
Pawan Kumar earned 250 total points
ID: 41865594
Hi,
One more update if you want to learn more in SSMS area, there a blog which is dedicated in this area-

http://www.ssmstipsandtricks.com/

Hope it helps!

Regards,
Pawan
0
 
LVL 46

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points
ID: 41866709
- Type 'select' then being ask the table.
You can't. After SELECT is expect a constant or a list of column names. Jim already said how to do the trick by adding the FROM clause.

- If we type 'select table-name' and place the cursor after 'select' we would like to be displayed a list of column for that table (without haing to place 'table-name C'.
As I said above, after a SELECT isn't a column name that's expected. You can add another SELECT, functions, variables or constants and those are things that Intellisense is showing you. To restrict only to column names you'll need to provide the table, view or alias so the related columns will be listed.


- or if there some short we can store statements for faster scripting.
- Finally, any other good practice in time-saving query-typing any EE can help in.
For both options you can use templates. Those are scripts that you should only need to write them once an store them in the disk for later use with the Template Explorer.
TemplateExplorer.PNG
0
 
LVL 24

Expert Comment

by:Pawan Kumar
ID: 41871709
Hi,
Appreciate a feedback on this.

Regards,
Pawan
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now