SQL User Defined Function Within Select SQL User Defined Function Within Select sql-server sql-server

SQL User Defined Function Within Select


Yes, you can do almost that:

SELECT dbo.GetBusinessDays(a.opendate,a.closedate) as BusinessDaysFROM account aWHERE...


If it's a table-value function (returns a table set)you simply join it as a Table

this function generates one column table with all the values from passed comma-separated list

SELECT * FROM dbo.udf_generate_inlist_to_table('1,2,3,4')


Use a scalar-valued UDF, not a table-value one, then you can use it in a SELECT as you want.