Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Server 2000 - Substring or replace for a binary value Expand / Collapse
Author
Message
Posted Tuesday, October 2, 2012 2:06 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 5:36 AM
Points: 22, Visits: 96
How to substring or replace 0x from a binany value 0xF60F9125DBA7E94012F55E2177C95C0E906862B1
in SQL Server 2000 using tsql. The output should be F60F9125DBA7E94012F55E2177C95C0E906862B1
Post #1367278
Posted Tuesday, October 2, 2012 3:19 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, September 15, 2014 11:49 AM
Points: 1,848, Visits: 587
your string = 0xF60F9125DBA7E94012F55E2177C95C0E906862B1

try this in your SQL Statement
REPLACE ( '0xF60F9125DBA7E94012F55E2177C95C0E906862B1' , '0x' , '' )

Good Luck...
Post #1367305
Posted Tuesday, October 2, 2012 3:32 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, November 4, 2014 7:47 AM
Points: 854, Visits: 584
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)
Post #1367310
Posted Wednesday, October 3, 2012 7:59 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 5:36 AM
Points: 22, Visits: 96
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','')
Post #1367695
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse