Generate Comma Separate Values for Employees in North-wind Database
Generate Comma Separated Value in SQL Server ( using Northwind Database )
-- Generate Comma Separated Values
-- Use Northwind Database
USE Northwind ;
GO
-- Decalre CSV Variable and set with blank
DECLARE @CSV Varchar(5000) ;
Set @CSV ='';
-- Now concatenate Employee name with comma
SELECT @CSV = ( @CSV + Employees.FirstName + ',') FROM dbo.Employees
-- Finally Print
PRINT @CSV ;
-- Linkedin Profile : https://www.linkedin.com/in/harshasannareddy/