Auto complete inner joins using foreign keys - by Ramon de Klein

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 801349 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 9/18/2013 7:46:28 AM
Access Restriction Public


I write a lot of queries in SQL Server Management Studio. In most queries I need to perform joins. Most inner joins are based on foreign key relations, so it would be perfectly possible to propose a join clause.

Suppose I type the following query:

FROM Employee

And there is a foreign key that specifies that the Company_Ref column always refers to the Company's CompanyId column. In that case it could suggest to autocomplete this statement to:

FROM Employee
INNER JOIN Company ON Employee.Company_Ref = Company.CompanyId

This would save a lot of typing
Sign in to post a comment.
Posted by Microsoft on 9/20/2013 at 1:09 PM
Hello Ramon.
Thank you for bringing this to our attention. We really do appreciate the feedback. We’ll investigate and get back to you.
-Walter A Jokiel, Program Manager, SQL Server (
Posted by Dave Wentzel (live) on 9/18/2013 at 8:59 AM
The ANSI standard specifies a NATURAL JOIN which is kinda what you want. But that uses like named cols. I agree that a variant of NATURAL JOIN that uses key relationships would not only alleviate typing, but bugs too. It's real easy to get a JOIN col wrong if you aren't paying attention.

This also follows the principle of "don't repeat yourself." The JOIN condition should be declared once and then used everywhere.