For some arbitrary SQL, I would like to get the data types of the returned columns. An operator can join many tables, views, TVF, etc. I know that I could create a view based on the request and get data types from it, hoping it will be faster. Just think that I could think of writing .net utilities to run SQL and examine the results, wondering if there is a TSQL answer.
i.e.
Given (not real tables just an example)
SELECT p.Name AS PersonName, p.Age, a.Account as AccountName
FROM Person as p
LEFT JOIN Account as a
ON p.Id = a.OwnerId
I would like to have something like
Username: (nvarchar (255), not null)
Age: (smallInt, not null)
etc...
source
share