GuRAm
GuRAm

Reputation: 777

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'?

Upvotes: 2

Views: 584

Answers (1)

Thom A
Thom A

Reputation: 95534

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.

Upvotes: 5

Related Questions