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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Convert Current to Hex

Author  Topic 

vgame64
Starting Member

3 Posts

Posted - 2009-06-10 : 13:24:59
Hi folks. I have a table in which I want the last column to be a hex conversion of the first column (which is an identity starting at 1, and incrementing by 1).

Any idea how to do this? I'm not a SQL dev/admin, our SQL guy is on vacation and I'd like to finish this without waiting for him.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-10 : 13:42:20
http://classicasp.aspfaq.com/general/how-do-i-convert-from-hex-to-int-and-back.html
Go to Top of Page

vgame64
Starting Member

3 Posts

Posted - 2009-06-10 : 13:43:32
So that is the formula. How would I have it point to the field member_id in the current row?

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-10 : 13:45:40
just use update to populate new column

update yourtable set member_id=CONVERT(VARBINARY(8), youridcolumn)
Go to Top of Page

vgame64
Starting Member

3 Posts

Posted - 2009-06-10 : 13:47:12
Perfect, this is easier than writing a function which I was about to do.

Thanks guys, issue solved!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-10 : 14:02:36
welcome
Go to Top of Page
   

- Advertisement -