ms sql int to bit
declare @intvalue int
set @intvalue=9999999
declare @vsresult varchar(64)
declare @inti int
select @inti = 24, @vsresult = ''
while @inti>0
begin
select @vsresult=convert(char(1), @intvalue % 2)+@vsresult,
@intvalue = convert(int, (@intvalue / 2)),
@inti=@inti-1
end
select @vsresult
No comments:
Post a Comment