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

发表于:2007-07-02来源:作者:点击数: 标签:
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://www.ltesting.net