SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server 2000 - Substring or replace for a binary value


SQL Server 2000 - Substring or replace for a binary value

Author
Message
svakka
svakka
SSC-Enthusiastic
SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)

Group: General Forum Members
Points: 154 Visits: 96
How to substring or replace 0x from a binany value 0xF60F9125DBA7E94012F55E2177C95C0E906862B1
in SQL Server 2000 using tsql. The output should be F60F9125DBA7E94012F55E2177C95C0E906862B1
pchirags
pchirags
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2717 Visits: 616
your string = 0xF60F9125DBA7E94012F55E2177C95C0E906862B1

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

Good Luck...
piotrka
piotrka
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1146 Visits: 689
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)
svakka
svakka
SSC-Enthusiastic
SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)

Group: General Forum Members
Points: 154 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','')
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search