???? ID: 104829 - ????? ???????: 02 ?????? 2010 - ??????: 4.0

???????: ?????? ??????? ???? Hexadecimal ???????? ?? ???

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
??? ?? ??????? ???? | ??? ?? ??????? ????

??????

SQL ????? ?? ?? ???????????? ???????? ?? ??????? ???? ?? ?????? ???? ?? ??? ?????????? Transact SQL ???? ???? ???

???? ???????

???? ?? ?? ???? ??????? ???? ?? ??? ??? ?? ???? ??? ???? ??? ?????? ???? Transact SQL ???? ??????? ???? ??? ?????? ???? ??? SQL ????? ????? ??????? ???? ?? ???????? ???? ???? ??, ?? ??? ???????? ??? ?? ?????? ???? ??, ?? ??? ?? ???????? ??? ?????? ???? ???? ?? ??? ASCII ??? ?? ??? ??? ????? ???? ??? ?? ??????? ??? ??????, varbinary ?? ??????????? datatypes ???? ???? ???

?????? ?? ??? ?????? ??? 00001111 (???????????? ??? 0x0F) ??? ???? ???????? ?????? 15 ?? ?? ?????? ??, ??? ??? ?????? ???? ?? ??? ??? ASCII 15, ?? ??????? ???? ?? unreadable ???

???? ???? ???????? ?? ?????? ?? ??????? ??? ?? ???????????? ???????????? ?? ???? ???? ?? ??? ????? ???????? ????????? ?? ????? ???? ?? ????:
   create procedure sp_hexadecimal
     @binvalue varbinary(255)
   as
   declare @charvalue varchar(255)
   declare @i int
   declare @length int
   declare @hexstring char(16)

   select @charvalue = '0x'
   select @i = 1
   select @length = datalength(@binvalue)
   select @hexstring = "0123456789abcdef"

   while (@i <= @length)
   begin

     declare @tempint int
     declare @firstint int
     declare @secondint int

     select @tempint = convert(int, substring(@binvalue,@i,1))
     select @firstint = floor(@tempint/16)
     select @secondint = @tempint - (@firstint*16)

     select @charvalue = @charvalue +
       substring(@hexstring, @firstint+1, 1) +
       substring(@hexstring, @secondint+1, 1)

     select @i = @i + 1

   end

   select 'sp_hexadecimal'=@charvalue
				

?????? ?? ???, ?? ????? ???? ??? ?? ????????? ISQL ?? ???:
     declare @bin varbinary(255)
     select @bin = @@dbts
     execute sp_hexadecimal @bin
     select 'isql' = @bin
     go
				

?? ?????? ????? ?? ???? ???? ???:
     sp_hexadecimal
     ------------------------------------------------------------------
     0x01000000a60b0000

     (1 row affected)


     isql
     ------------------------------------------------------------------
     0x01000000a60b0000
     (1 row affected)
				

???? ???? ???? ??:
  • Microsoft SQL Server 4.21a Standard Edition
  • Microsoft SQL Server 6.0 Standard Edition
  • Microsoft SQL Server 6.5 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition
??????: 
kbinfo kbother kbmt KB104829 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:104829  (http://support.microsoft.com/kb/104829/en-us/ )