Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mp
Starting Member
2 Posts |
Posted - 2008-06-12 : 12:06:58
|
This function allows me to convert decimal smallint into hexadecimal.but this function doesn't convert negative decimal numbers into hexadecimal. SET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GOALTER function DECTOHEX(@n int ) --Converts a decimal number to hexadecimal.returns varchar(255)asBEGINDECLARE @i int,@temp int, @s varchar(255)SET @i=@nSET @s=''WHILE (@i>0)BEGINSET @temp=@i % 16SET @i=@i /16IF @temp>9 SET @s=char(55+@temp)+@sELSE SET @s=char(48+@temp)+@sENDRETURN @sEND |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-12 : 12:31:20
|
Select cast(your_value as varbinary(100))MadhivananFailing to plan is Planning to fail |
 |
|
mp
Starting Member
2 Posts |
Posted - 2008-06-12 : 13:02:35
|
simple enough...thanks so much. |
 |
|
|
|
|