This query converts dynamic int to binary, but I want to split into rows.
declare @value int 
set @value = 96
declare @result varchar(32) 
set @result = '' 
while 1 = 1 
begin
    select 
        @result = convert(char(1), @value % 2) + ',' +@result,
        @value = convert(int, @value / 2) 
    if @value = 0 break  
end
select substring(@result, 1, len(@result)-1) as result
Please help me to find a solution.
This is the result of my query.
1,1,0,0,0,0,0
My question is: how can I split this result into rows from right to left?
My result will need to be this (I'm trying to insert into a #table):
0
0
0
0
0
1
1
Thanks
 
     
    