If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Increment HexDecimal Values

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-26-08, 08:48
BindhuM BindhuM is offline
Registered User
 
Join Date: Aug 2008
Posts: 4
Increment HexDecimal Values

Hi,

I have to increment Hexadecimal values which is of type NVARCHAR.
for Eg. 123A
This value has to be incremented 6 times.
as
123B
123C
124D
124E
124F
1250

I would appreciate if get some help.

Thanks & Regards
BindhuM
Reply With Quote
  #2 (permalink)  
Old 08-26-08, 11:17
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Can you store binary instead? Makes it lots easier to increment
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 08-26-08, 12:52
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
I forget the details.. the manuel should be able to help
it should be possible to cast the hex value to an integer do your arithmatic and save the resultant value using the hex function

you could also do a similar approach depending on your front end
IIRC you can also directly assign hex values to intger datatypes (presumably integer and biginteger
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #4 (permalink)  
Old 08-26-08, 19:01
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
Is there a reason that you don't store this as an integer or decimal value which would make your task much easier? Do you need to produce each of the six values, or only the final value? What is your input range (largest and smallest values)?

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On