-1

I have a column with Hashbytes values: 0xDA39A3EE5E6B4B0D3255BFEF95601890AFD80709 which is a Binary data type. I need to create a column as DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 without 0x using ssis. I have tried various methods but I just end up strange characters such as 㧚歞ോ唲悕逘�इ.Thanks.

Djbril
  • 745
  • 6
  • 26
  • 48

1 Answers1

1

In SQL, when you convert binary to string, you can set a flag in the convert statement that will preserve the text, like 20:

declare @b as varbinary(50) = hashbytes('sha1','somehash')

select @b
, Convert(varchar(50), @b)
, Convert(varchar(50), @b, 1)
, substring(Convert(varchar(50), @b, 1), 3, len(Convert(varchar(50), @b, 1))) --output without the 0x
Mark Wojciechowicz
  • 4,287
  • 1
  • 17
  • 25