I'm querying a database and payload data is stored in an image column in Microsoft SQL Server 2019. I want to read the actual text value of this column.
I wrote following query:
SELECT CAST(PAYLOAD AS NVARCHAR(MAX)) FROM MY_TABLE
It gave me the error: Explicit conversion from data type image to nvarchar(max) is not allowed.
It doesn't seem to work and I'm looking for a way to convert this value to a text in a select query.
You can use a double conversion:
The whole example:
Note: Image type is deprecated.