title: how to create udf in ms sql which performs group_concat in operation in mysql for generic table not for specific table
body: <p>how to create udf in mssql which performs group_concat() operation in mysql for generic table not for specific table...</p>
  
  <p>I tried it in this way but its not working for generic table(any table column) </p>
  
  <pre><code> CREATE FUNCTION [dbo].[GROUP_CONCAT](
      @tableColumn varchar(max),
      @separator varchar(max)
      )
      returns varchar(max)
      as
      begin
      declare @concatResult varchar(max)
      select @concatResult =STUFF((SELECT DISTINCT @separator + CAST( @tableColumn AS varchar) 
      From ?
      FOR XML PATH('')), 1, 1, '')
      return @concatResult
      end; 
  </code></pre>