十进制转换成二进制(如8转成1000)

类别:数据库 点击:0 评论:0 推荐:
alter proc prc_num @num bigint
as
declare @numstr varchar(50)
set @numstr=''
while (@num<>0)
begin
   set @numstr=@numstr+convert(char(1),@num%2)
   set @num=@num/2
end
select reverse(@numstr)


exec prc_num 8

本文地址:http://com.8s8s.com/it/it20140.htm