Using guid in sqlite select, where guid is stored in sqlite db as binaries

I have a table Employeein a SQLite database. The first key is a "ID" of type GUID. I am trying to find an entry with id= guid 'a8828ddf-ef22-4d36-935a-1c66ae86ebb3'with the following query with no luck:

SELECT * FROM Employee
WHERE Employee.Id = 'a8828ddf-ef22-4d36-935a-1c66ae86ebb3'

Can someone tell me how to write a request?

Thank,

+5
source share
2 answers

The GUID is probably stored as a binary blob; try:

SELECT * FROM Employee
WHERE Employee.Id = X'a8828ddfef224d36935a1c66ae86ebb3';
+6
source

This is an old question, but it is suitable for searching, and although the selected answer is correct, it may not work for everyone easily. For example, when using .NET bindings to SQLite.

, GUID a8828ddf-ef22-4d36-935a-1c66ae86ebb3, X'...'. GUID , -.

GUID a8828ddf-ef22-4d36-935a-1c66ae86ebb3, X'df8d82a822ef364d5a93b3eb86ae661c'. , .

, , X'a8828ddfef224d36935a1c66ae86ebb3', , .NET , GUID endian.

( , )

+7

All Articles