Cannot find either column “dba” or the user-defined function or aggregate “schema.functionName”, or the name is ambiguous

functions

I created a function and granted select on [dba].[ufn_track_dailies] to public. The function shows up under table valued functions, but when I try to use it I get an error:

select [dba].[ufn_track_dailies]('Real Name','', '08-01-2015', '08-31-2015')

Best Answer

If this is for SQL Server (and maybe others as well?), then you cannot SELECT a TVF, you need to SELECT FROM a TVF ;-) And, you need to use those silly parenthesis when calling functions:

SELECT * FROM [dba].ufn_track_dailies();

If it were a scalar function, that would be:

SELECT [dba].ufn_track_dailies();