Q:

Table-valued Function return type

How to get return type of table-valued function?
This returns TABLE result:
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_NAME = 'MyTableValuedFunctionName';

But, my function returns uniqueidentifier list.
From where can I get a type 'uniqueidentifier'?

A:

Expanding on the answer here, you could do:
SELECT c.[name] AS ColumnName,
       t.[name] AS datatype,
       t.max_length AS [Length],
       t.[precision],
       t.scale
FROM sys.columns c
     JOIN sys.types t ON c.system_type_id = t.system_type_id
WHERE c.object_id=object_id('dbo.MyTableValuedFunctionName'); --Assumes you function is on the dbo schema.

