SQL - Convert to Hex

Often times when getting really down and dirty with SOLIDWORKS Enterprise PDM, I need to know a document’s ID value in hex format. Back in the old days [yesterday] I would do a SQL query on the document’s table and then manually calculate the hexadecimal value.

However I found a SQL function that will do the conversion for me:
CONVERT(varbinary,<value>)

Cool eh? Thus a SQL statement like this:

SELECT DocumentID, CONVERT(varbinary,DocumentID) as IDHex, Filename FROM Documents where Filename like 'Big Tuna%'

Returns:

, SQL &#8211; Convert to Hex

Yeah, SQL rocks.

  • Share this
Find Your Design Solution in the CATI Store.
Browse Products