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:

Cool eh? Thus a SQL statement like this:

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


Yeah, SQL rocks.