斯柯达老明锐遥控器汽车钥匙换电池子磁(全过程)

数字转换成十六进制.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[f_int2hex]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[f_int2hex]
GO

/*--数字转换成16进制

--邹建 2004.04(引用请保留此信息)--*/

/*--调用示例

 --调用
 select dbo.f_int2hex(123)
--*/
create function f_int2hex(@num int)
returns varchar(100)
as
begin
 declare @re varchar(100)
 set @re=''
 while @num>0
  select @re=substring('0123456789ABCDEF',@num%16+1,1)+@re
   ,@num=@num/16
 return(@re)
end
go


 

posted @ 2012-05-19 18:28  读书  阅读(223)  评论(0编辑  收藏  举报