If 2012+ You can use concat(). Also included STUFF() for a "cleaner" string.
Example
Declare @YourTable table (SomeCol varchar(25))
Insert Into @YourTable values
('1000000'),
('1100000'),
('0100000'),
('1111111')
Select *
,NewCol = stuff(
concat(
', '+IIF(substring(SomeCol,1,1)='1','Monday' ,null)
,', '+IIF(substring(SomeCol,2,1)='1','Tuesday' ,null)
,', '+IIF(substring(SomeCol,3,1)='1','Wednesday',null)
,', '+IIF(substring(SomeCol,4,1)='1','Thursday' ,null)
,', '+IIF(substring(SomeCol,5,1)='1','Friday' ,null)
,', '+IIF(substring(SomeCol,6,1)='1','Saturday' ,null)
,', '+IIF(substring(SomeCol,7,1)='1','Sunday' ,null)
),1,2,'')
From @YourTable
Returns
SomeCol NewCol
1000000 Monday
1100000 Monday, Tuesday
0100000 Tuesday
1111111 Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
EDIT - For 2008
Declare @YourTable table (SomeCol varchar(25))
Insert Into @YourTable values
('1000000'),
('1100000'),
('0100000'),
('1111111')
Select *
,NewCol = stuff(
case when substring(SomeCol,1,1)='1' then ', Monday' else '' end
+case when substring(SomeCol,2,1)='1' then ', Tuesday' else '' end
+case when substring(SomeCol,3,1)='1' then ', Wednesday' else '' end
+case when substring(SomeCol,4,1)='1' then ', Thursday' else '' end
+case when substring(SomeCol,5,1)='1' then ', Friday' else '' end
+case when substring(SomeCol,6,1)='1' then ', Saturday' else '' end
+case when substring(SomeCol,7,1)='1' then ', Sunday' else '' end
,1,2,'')
From @YourTable
dotnetnuke
? – VDWWD