October 2, 2012 at 2:06 pm
How to substring or replace 0x from a binany value 0xF60F9125DBA7E94012F55E2177C95C0E906862B1
in SQL Server 2000 using tsql. The output should be F60F9125DBA7E94012F55E2177C95C0E906862B1
October 2, 2012 at 3:19 pm
your string = 0xF60F9125DBA7E94012F55E2177C95C0E906862B1
try this in your SQL Statement
REPLACE ( '0xF60F9125DBA7E94012F55E2177C95C0E906862B1' , '0x' , '' )
Good Luck...
October 2, 2012 at 3:32 pm
You can use substring in SQL 2000
Here is an example:
declare @fg char(100)
set @fg = '0xF60F9125DBA7E94012F55E2177C95C0E906862B1'
select @fg
select substring(@fg, 3, 98)
October 3, 2012 at 7:59 am
Thank you all for the responses. Substring and replace will not work on binary value unless we do the conversion to a string, did the conversion in the following way and it worked
replace(upper(master.dbo.fn_varbintohexstr('0xF60F9125DBA7E94012F55E2177C95C0E906862B1'
)),'0x','')
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply