Let's say I have this query in SSMS:
select
[Cars Sold],
[Cars In Lot],
[Available Cars],
[Car Models]
from
Cars c inner join CarDetails cd on
c.CarId = cd.CarId
inner join MoreCarDetails mcd on
c.CarId = mcd.CarId
inner join ymcs on
c.CarId = ymcs.CarId
Within the query window and without having to query all the tables or run a script that searches for column names, how can I know which table or alias the column [Cars Sold]
belongs to?
If I place the cursor over the column, I'll see a popup with the column type, like this: Column Cars Sold (nvarchar(20), null)
, but it doesn't show the table name.
2条答案
按热度按时间ijxebb2r1#
SSMS does not natively provide a way to expose the table of origin for column names in the way that you are asking (no manual review, no execution of scripts), though a number of add-on solutions exist to provide this information.
8yoxcaq72#
Turn on the Actual Execution Plan and the Output List of each element should tell you.
That's the only way I can think of but it should remind you to ALWAYS use the alias or table name when selecting columns.