In one to many relationships of two tables, sometimes we need to write a query which can return comma separated list of all child values for each parent.
Here are two different methods by which you can easily create a Comma Separated List, the first runs from sql 2000 onwards and the second on is for SQL 2005 onwards.
USE tempdbName varchar(50) ,SELECT 'One'SELECT 'Two'SELECT 'Three'SELECT 'Four'
SQL Server 2000 Onwards Version
FROM [dbo].[student]SELECT @Csv
SQL Server 2005 Onwards version