Re: DEC TO HEX CONVERSION WHILE IMPORTING
From: MUSTAFA (mustafakh_at_yahoo.com)
Date: 05/13/04
- Next message: Freger: "query"
- Previous message: Steve Kass: "Re: DEC TO HEX CONVERSION WHILE IMPORTING"
- In reply to: Steve Kass: "Re: DEC TO HEX CONVERSION WHILE IMPORTING"
- Next in thread: mustafa: "Re: DEC TO HEX CONVERSION WHILE IMPORTING"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 May 2004 01:03:37 -0700
YES IT WORKS
THANKS Mr. STEVE
>-----Original Message-----
>Mustafa,
>
> If your decimal values fit into a bigint, you could
write a
>user-defined function (SQL Server 2000 required):
>
>create function dec2hex (
> @decimal bigint
>) returns varbinary(20) as begin
> declare @b varbinary(20)
> set @b = 0x
> while @decimal > 0 begin
> set @b = cast(cast(@decimal%256 as tinyint) as binary
(1)) + @b
> set @decimal = @decimal/256
> end
> return @b
>end
>go
>
>select dbo.dec2hex(1)
>select dbo.dec2hex(2571551874.0)
>
>go
>drop function dec2hex
>
>-- Steve Kass
>-- Drew University
>-- Ref: 77AF63E1-A927-40A1-A7B0-6EA31F1C80F2
>
>MUSTAFA wrote:
>
>>I HAVE DECIMAL NUMBER IN MY TEST TABLE COLUMN
CARD_NUMBER
>>AS FOLLOWS
>>2571549730.0
>>2571549826.0
>>2571550034.0
>>2571550210.0
>>2571550306.0
>>2571551378.0
>>2571551586.0
>>2571551682.0
>>2571551762.0
>>2571551874.0
>>
>>I WANT TO CREATE A TEMP TABLE AND MOVE THIS COLUMN BUT
>>BEFORE MOVING IT SHOULD CONVERT INTO HEXADECIMAL NUMBER
>>WHILE INSERTING INTO TEMP TABLE
>>
>>
>>THANKS
>>
>>
>
>.
>
- Next message: Freger: "query"
- Previous message: Steve Kass: "Re: DEC TO HEX CONVERSION WHILE IMPORTING"
- In reply to: Steve Kass: "Re: DEC TO HEX CONVERSION WHILE IMPORTING"
- Next in thread: mustafa: "Re: DEC TO HEX CONVERSION WHILE IMPORTING"
- Messages sorted by: [ date ] [ thread ]