Here i am telling about concatenating column value into comma-separated list as below:
Declare @AllEmail AS VARCHAR(8000),@Position int=3
Declare @t table (ID int identity,EmailID nvarchar(200))
Insert into @t(EmailID)
Select distinct(EmailID) From Employee Where Position=@Position AND IsActive=1 AND IsDeleted=0
SELECT @AllEmail = ISNULL(@AllEmail +';','') + EmailID FROM @tHere you get output at resultset as comma separated email id.
SELECT @AllEmail
No comments:
Post a Comment