ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Function to get comma (delimited) separated values from Table in SQL Server<p>Hi <a class="username" rel="nauna"> nauna</a>,</p> <p>Refer below sample query.</p> <p><span style="text-decoration: underline;"><strong>SQL</strong></span></p> <pre class="brush: sql">DROP FUNCTION GetCommaSeparatedString GO CREATE FUNCTION GetCommaSeparatedString(@City NVARCHAR(15)) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @Output VARCHAR(MAX) SELECT @Output = COALESCE(@Output + &#39;,&#39;, &#39;&#39;) + CAST(EmployeeId AS VARCHAR(5)) FROM Employees WHERE City = @City RETURN @Output END GO SELECT dbo.GetCommaSeparatedString(&#39;London&#39;) AS Ids</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/969177/Function-to-get-comma-delimited-separated-values-from-Table-in-SQL-Server/https://www.aspforums.net:443/Threads/969177/Function-to-get-comma-delimited-separated-values-from-Table-in-SQL-Server/Mon, 13 May 2019 04:40:07 GMT