Solved

Best way to use SSMS intellisense when querying

Posted on 2016-10-29
5
75 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 28

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 28

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 48

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 28

Expert Comment

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

Regards,
Pawan
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL trigger 5 23
Transact SQL - Frequency of Length of Distinct Values 3 26
SQLCMD Syntax 2 16
SQL Recursion 6 20
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

830 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