Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi,I want to take max of Id column in hexadecimal. For eg:11100000 A 11110000 AB11111000 ABCFOR ABCD the ID should be 11111100Please advise on this problem! Thanks.GKgk
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts
Posted - 2006-07-13 : 06:39:11
gk - I don't understand what you want. Do you want to convert between different bases (base 16 and base 2)? Where does the max come in?I don't understand how 11100000 relates to A, or why the ID should be 11111100 for ABCD.Can you give more information...Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part.
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2006-07-13 : 06:53:02
Not really sure what you want... Is it something like this ?
declare @table table( id varchar(8), col varchar(10))insert into @tableselect '11100000', 'A' union allselect '11110000', 'AB' union allselect '11111000', 'ABC'declare @max varchar(8)select @max = max(id)from @tableselect '1' + left(@max, 7)