Contents

1 bit 一 覓語
2


1 bit 一 覓語 #

襯 れ, 200606 ~ 200812蟾讌 危 覿襯 bit襦 貉殊 り 螳.
れ螻 螳 2螳讌 bit 覓語伎 .

  • 111000101111000000 --> int 232384
  • 111100101111000001 --> int 248769

讀, 101000000000000000 企, 200606, 200608 蟆企. 襷 2螳 bit 覓語伎 谿企ゼ 觜蟲る 企至 伎 蟾?

2 #

with dumy
as
(
        select 1 seq
        union all
        select seq + 1 from dumy
        where seq + 1 <= datediff(dd, '20060601', getdate())
), rs
as
(
	select 
		seq 
	,	convert(char(6),dateadd(mm, seq, '20060601'), 112) yyyymm
	from dumy
), bits
as
(
	select '111000101111000000' bit1, '111100101111000001' bit2
	--232384 ^ 248769
)
select
	b.yyyymm
from bits a
	inner join rs b
		on b.seq <= len(a.bit1)
where substring(a.bit1, seq, 1) <> substring(a.bit2, seq, 1)
option (maxrecursion 0);