George Ionescu wrote:
However, wanting to test how the engine compares strings and numbers:
SELECT 'match' WHERE '500' = 500;
returns 'match'; also, the following statements return the same result:
SELECT 'match' WHERE ' 500 ' = 500; SELECT 'match' WHERE '500' = 499 + 1;
Who can tell me what other SQL database engines do with the following?
Tested with Postgres V7.3.2:
CREATE TABLE test1(a VARCHAR(100));
CREATE TABLE
INSERT INTO test1 VALUES('501');
INSERT 24969 1
INSERT INTO test1 VALUES(' 502 ');
INSERT 24970 1
SELECT * FROM test1 WHERE a=501;
a ----- 501 (1 row)
SELECT * FROM test1 WHERE a=502;
a ----- (0 rows)
SELECT * FROM test1 WHERE a<'502';
a ----- 501 502 (2 rows)
Or how about this:
CREATE TABLE test2(b INTEGER);
CREATE TABLE
INSERT INTO test2 VALUES(503);
INSERT 24973 1
INSERT INTO test2 VALUES(504);
INSERT 24974 1
SELECT * FROM test2 WHERE b='503';
b ----- 503 (1 row)
SELECT * FROM test2 WHERE b>'503';
b ----- 504 (1 row)
-- Daniel Lee Kruse
Pursuant to U.S. code, title 47, Chapter 5, Subchapter II,Section 227, any and all unsolicited commercial E-mail sent,to this address is subject to a fee of $500.00 U.S. E-Mailing denotes, acceptance of these terms. Consult http://www.law.cornell.edu/uscode/47/227.html for details.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]