0

I need to copy data from one column to another after converting. There is a column of type binary(255) and another column in a same table of type varchar(255). how to migrate data from binary to varchar column after using convert function. i.e CONVERT(VARCHAR(255), ?, 2)

Is there any other solution without copy data to another column? any direct change column solution ?

honey
  • 3
  • 4
  • Update table set col1 = CONVERT(VARCHAR(255), col2) – mohan111 Aug 08 '17 at 10:02
  • Probable duplicate of [conversion](https://stackoverflow.com/questions/1873085/how-to-convert-from-varbinary-to-char-varchar-in-mysql) – MKR Aug 08 '17 at 10:07
  • This is working but still i am facing an issue i.e old column data is 0x44084710023640B99A4B96A2E7268437000000000 zeros are upto 255 and new column data is DG6@¹šK–¢ç&„7 – honey Aug 08 '17 at 11:10

1 Answers1

0
UPDATE [Table]
SET [varchar_column] = CONVERT(VARCHAR(255), [binary_column])
-- WHERE x = y <-- If you only want to update certain records.
HoneyBadger
  • 14,750
  • 3
  • 34
  • 48