On SQL Server 2000, the following queries:

select
 case when '500' = 500 then 'Equal'
 else 'Not equal'
 end

select
 case when 500 = '500' then 'Equal'
 else 'Not equal'
 end

select
 case when 500 <> '500' then 'Not Equal'
 else 'Equal'
 end

select
 case when '500' <> 500 then 'Not Equal'
 else 'Equal'
 end

produce these results:


--------- 
Equal

(1 row(s) affected)


--------- 
Equal

(1 row(s) affected)


--------- 
Equal

(1 row(s) affected)


--------- 
Equal

(1 row(s) affected)





> Who can tell me what other SQL database engines do with
> the following?
>
>     CREATE TABLE test1(a VARCHAR(100));
>     INSERT INTO test1 VALUES('501');
>     INSERT INTO test1 VALUES('  502  ');
>     SELECT * FROM test1 WHERE a=501;
>     SELECT * FROM test1 WHERE a=502;
>     SELECT * FROM test1 WHERE a<'502';


(1 row(s) affected)


(1 row(s) affected)

a                                                                           
                         --------------- 
501

(1 row(s) affected)

a                                                                           
                         --------------- 
  502

(1 row(s) affected)

a                                                                           
                         --------------- 
501
  502

(2 row(s) affected)



> Or how about this:
>
>     CREATE TABLE test2(b INTEGER);
>     INSERT INTO test2 VALUES(503);
>     INSERT INTO test2 VALUES(504);
>     SELECT * FROM test2 WHERE b='503';
>     SELECT * FROM test2 WHERE b>'503';


(1 row(s) affected)


(1 row(s) affected)

b
----------- 
        503

(1 row(s) affected)

b
----------- 
        504

(1 row(s) affected)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to