How to determine the data type of all fields in a result set in SSDT? I'm writing a table valued function in SQL Server Data Tools (SSDT).  Table valued functions require you to explicitly state the data type of the returned table.  In my particular case, I've written a query which returns the values that I want.  I can execute it using SSDT, but can't figure out how to quickly determine the data type of the columns returned.

Is there a way to get the list of columns that it returns and the data types of said columns so I can quickly and accurately populate the list of columns in the ReturnTable?

The closest I've gotten is to hover over the field name in the SELECT clause, but that doesn't provide the length or precision limitations.  



Edit: I struck through my comment regarding table valued functions require you to explicitly state the data types of the columns in the returned table based on @srutkzy's answer.  Thanks!
You can use the SELECT..INTO syntax to create a table on-the-fly and examine the resultant column definitions in sys.columns.

select
  *
into #SomeName
from &lt;your query goes here&gt;
where 1=0 -- because we only want the metadata


I think sys.columns has definitons for functions, too, but I don't have an instance to hand just now to check.  Alternately you could create a view with the same query you are about to put into your function and check the catalogue for that.