Expand SELECT *
brucekillam
Posts: 8
I have a script that generates queries and quite often these queries contain many joins. When I copy this query into a new query window in SSMS and place my cursor after the '*' and hit tab, only columns from the first two tables are expanded (many of my queries have well over 5 joins). To get it to work correctly, I have to place the cursor at the very end of the query, put a space at the end, and then when I perform the expand operation, I see all of the columns from all of the joined tables.
It was maddening and time consuming to try and figure out how to get the expand functionality to work correctly in this scenario, but once I figured out a work around, it isn't too difficult to do. However, you might want to see if you can duplicate the problem and isolate the bug.
It was maddening and time consuming to try and figure out how to get the expand functionality to work correctly in this scenario, but once I figured out a work around, it isn't too difficult to do. However, you might want to see if you can duplicate the problem and isolate the bug.
Comments
Thanks,
Bart
Principal Consultant
bartread.com Ltd
Thanks,
Bart
Principal Consultant
bartread.com Ltd
An example of this would be the following query (run from the ReportServer db):
Copy from the first character of the query to the last and paste it into a new query window (I'm using SSMS) and put the cursor after the * and hit tab. What I get is the following (notice that it only gives columns for the first two tables - P10tbl and R17fk; R18fk and R19fk seem to be ignored):
The below query on Adventureworks I think is similar to yours:
SELECT * FROM [Person].[Contact] P10tbl
JOIN [Sales].[StoreContact] R17fk ON P10tbl.[ContactID] = R17fk.[ContactID]
JOIN [Sales].[Individual] R18fk ON P10tbl.[ContactID] =R18fk.[ContactID]
JOIN [Sales].[ContactCreditCard] R19fk ON P10tbl.[ContactID] = R19fk.[ContactID]
but I can expand the star with no problems at all.
Red Gate Software