on 2011 Sep 20 5:38 AM
Hello,
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,
G.
I just tried the following with 12.0.1.3423, on Windows x64, and it seemed to be successful:
> ulinit ultest.udb > dbisql -ul -c "UID=dba;PWD=sql;UDB=ultest.udb"
SQL Code:
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 v12.0.1.3324). Trying with omitted/added hyphens should work as well:
select 1 from dummy where Cast('ca9ae8ad20404890bca5c93b54770516' as UNIQUEIDENTIFIER) = 'ca9ae8ad-2040-4890-bca5-c93b54770516'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.