Convert image datatype into varchar in sql server 2008

前端 未结 5 1898
后悔当初
后悔当初 2021-02-05 07:18

We have TestPartner database in SQL Server. The descriptions of the bugs are stored in \"image\" datatype column. We need to write a query to display the data as html table. We

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 07:46

    The simple answer is

    select cast(cast(my_column as varbinary(max)) as varchar(max)) as column_name
    from   my_table
    

    This converts the column to varchar format. nvarchar(max) might be better if you have unicode data.

提交回复
热议问题