Subject How to query for a GUID value that is stored as OCTETS?
Author Stefan Renzewitz
I'm programming in C# with NHibernate, but for some queries I'm using
direct SQL statements for performance reasons.

For my GUID columns I'm using Char(16) with charsets OCTETS now.
While
saving works fine I have no idea how to create my SQL statement.

So far my SQL looked like this:
"SELECT * FROM REPERTOIRE WHERE REPERTOIREGUID='" + gidRepertoire.
ToString() + "'"

Where gidRepertoire is a GUID.

Before I was storing the GUID as a simple char(36). Obviously I have
somehow to convert the GUID into a CHAR(16) with the charset OCTETS.
I
checked the encoding class, but couldn't find a promising method.
With
google I had no more luck.

So far I could only find examples how to store GUID's with charset
OCTETS, but not how to use them as a search criteria in a simple SQL
statement.

Thanks for any hint!

Stefan