Delete characters from a string

-1

I have a base in Access, with around 1000 records, which I convert to an SQL file. The images are saved in Hexadecimal as follows.

0x6C7400006C340000FFD8FFE000104A46494600010100000100010000FFDB00430006040506050406060506070706080A100A0A09090A140E0F0C1017141818171416161A1D251F1A1B231C1616202C20232627292A29191F2D302D28....... 

The situation is that I need to remove the first characters before the FFD8 but respecting the 0x.

Any ideas to read each record and delete those characters?

Thank you.

    
asked by AReyes 07.12.2018 в 18:33
source

1 answer

0

Try this way:

declare @texto varchar(5000) = '0x6C7400006C340000FFD8FFE000104A46494600010100000100010000FFDB00430006040506050406060506070706080A100A0A09090A140E0F0C1017141818171416161A1D251F1A1B231C1616202C20232627292A29191F2D302D28.......'

select ('0x' + substring(@texto, CHARINDEX('FFD8', @texto, 1), len(@texto))) resultado
    
answered by 07.12.2018 в 20:19