Hi
Step 1
========
create table temp
(
tempid int primary key identity(1,1),
statecode int,
Active int
)
Step 2
========
insert into temp values(4,1),(5,1),(8,1),(7,0)
statecode Active
1 4 1
2 5 1
3 8 1
4 7 0
Step 3
========
DECLARE @List VARCHAR(1000)
select @List=coalesce(@List+',' , '' )+ cast(statecode as varchar(10))
from Temp where Active=1
Select @list
--Your Output this
4,5,8
Name : Dotnet Developer-2015
Email Id : kumaraspcode2009@gmail.com
'Not by might nor by power, but by my Spirit,' says the LORD Almighty.