Hello everyone..here's my problem... I've a PreparedStatement with these query: "SELECT NAME FROM PERSON WHERE ID_COMPARTMENT=?" ID_COMPARTMENT is a INTEGER column. How I can set null value to the preparedStatement? I've tried ps.setNull(1,java.sql.Types.INTEGER), I haven't any error but the query does't return the correct result. The correct query should be "SELECT NAME FROM PERSON WHERE ID_COMPARTMENT IS NULL" and I think the setNull method doesn't replace the =? and place instead "IS NULL". Did anyone can help me to solve this problem? Thanks, Andrea
Originally posted by Ed zhang: But it really works well in sybase. I wonder if it's a bug of sqlserver.
If Sybase considers "NULL = NULL" to be true, it's a bug in Sybase. It's been a while since I've used it, but I can't imagine Sybase has changed to violate the standard rules of relational databases.
Of course, I suppose the Sybase JDBC driver could be really clever and do automatic string replacements, but that seems like it would be a big hole to introduce other bugs. [ January 06, 2005: Message edited by: David Harkness ]
I think it's a good merit of Sybase in my opinion. I think SUN should issue the standards of PreparedStatement implements.
It would actually be a SQL/database standard. The PreparedStatement passes through SQL to the database. So Sun wouldn't be in a position to issue standards on it. They could issue standards on setting parameters in a PreparedStatement. In fact they do.