Skip to main content
grimcha
Gold ⭐️
Mar 17, 2026 2:53 PM UTC
Solved

QueryDatabaseTableRecord converting varbinary column to text?

Edit: Tried using CSVWriter, XMLWriter and AvroWriter. All NG.

 

Nifi Version2.5.0
ProcessorQueryDatabaseTableRecord 
Drivercom.microsoft.sqlserver.jdbc.SQLServerDriver

 

I have a requirement to pull varbinary data from a table however the  output is always text.  I expect a result starting with 0x. According to the jdbc driver within nifi, varbinary is supported however I see it gets converted to bytes. Is there a way to maintain the 0x format for the writer? 

Notes

grimcha
grimchaAnswer
Gold ⭐️
Mar 17, 2026 4:11 PM UTC

I have resolved this by forcing a CONVERT with a style of 1 to ensure binary output in the sql query with a 0x primer.  Documentation here: https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver17 

1 reply

grimcha
grimchaAuthorAnswer
Gold ⭐️
Mar 17, 2026 4:11 PM UTC

I have resolved this by forcing a CONVERT with a style of 1 to ensure binary output in the sql query with a 0x primer.  Documentation here: https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver17 

Translate