I have written an SQL Server custom inline function which returns a table with one single column.
ALTER FUNCTION [dbo].[tblServicesByHost]
 ( @IdService int )
RETURNS table
AS
RETURN (
    SELECT dbo.viewNagiosHostGroups.NagiosHostGroups, 
      dbo.tblServicesPerHostgroup.HostGroupName, 
       dbo.tblServicesPerHostgroup.IdService
FROM          dbo.viewNagiosHostGroups INNER JOIN
                     dbo.tblServicesPerHostgroup ON dbo.viewNagiosHostGroups.NagiosHostGroups = dbo.tblServicesPerHostgroup.HostGroupName LEFT OUTER JOIN
                     dbo.tblNagiosServiceDefinitions ON dbo.tblServicesPerHostgroup.ID = dbo.tblNagiosServiceDefinitions.ID
WHERE        (dbo.tblServicesPerHostgroup.IdService = @IdService)
   )
If I call that function, it will return a table variable. How can I transform one column of that table into a comma-separated list of values, which I can then use for further processing?
