简体   繁体   中英

SQL Server 2014 <Binary Data> in one field. How Can I extract

I have a SQL Server database where one table has a field where all the contents show in a query simply as "Binary Data" enclosed in <> .

I have tried writing queries using

Convert(Varchar(1000), Binary_data_Field)

I also found an article that suggested create a table using the code;

CREATE TABLE #bla(col1 varbinary(400)

INSERT #bla VALUES(CONVERT(varbinary(400)

SELECT col1, convert(varchar(max), col1) from #bla

When running the query I get this message;

"SQL text cannot be represented in the grid pane and diagram pane."

Can anyone explain this message and how I can fix or extract from the binary data?

This executes in SQL Server 2014 for me. There were a couple of format errors that needed fixing.

CREATE TABLE #bla(col1 varbinary(400))

INSERT INTO #bla VALUES ( CONVERT(varbinary(400),'Hello World') )

SELECT col1,convert(varchar(max),col1) as txt_value from #bla

DROP TABLE #bla

Returns

col1                        txt_value
0x48656C6C6F20576F726C64    Hello World

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM