I have a UUIDValue column, and I have to execute a query where in the condition there's specified a UUIDValue value. The problem is that I don't know how to specify this value correctly. I tried to use the UUIDValue value like a string, writing it between quotes:
SELECT * FROM myTable WHERE id='ca9ae8ad-2040-4890-bca5-c93b54770516'
with poor results. Then I tried without quotes, without dashes, but nothing!
Have you got any idea?
Thanks in advance,
I just tried the following with 18.104.22.16823, on Windows x64, and it seemed to be successful:
> ulinit ultest.udb > dbisql -ul -c "UID=dba;PWD=sql;UDB=ultest.udb"
CREATE TABLE myTable( id uniqueidentifier primary key default newid() ); INSERT INTO myTable; SELECT * FROM myTable; -- (Look at the results shown) SELECT * FROM myTable WHERE id = '2E9D76B0-F327-4633-A4D8-10DAB9794B8F'; -- (1 Rows)
You could try the following query to find out whether string values are converted correctly to UNIQUEIDENTIFIER values:
select 1 from dummy where Cast('ca9ae8ad-2040-4890-bca5-c93b54770516' as UNIQUEIDENTIFIER) = 'ca9ae8ad20404890bca5c93b54770516'
That should yield 1 (and does with v22.214.171.12424). Trying with omitted/added hyphens should work as well:
select 1 from dummy where Cast('ca9ae8ad20404890bca5c93b54770516' as UNIQUEIDENTIFIER) = 'ca9ae8ad-2040-4890-bca5-c93b54770516'