I use jdbc to retrieve data from SQL Server, and ANSI_NULLS is off . So if I run
select * from cj_log where evt = null
I can get the result.
But when I put it in a statement like this
Statement st = DBConnection.getConnection().createStatement();
String sql = "select * from CJ_LOG where EVT=null";
ResultSet rs = st.executeQuery(sql);
The result set is empty. What is the problem here?
select * from CJ_LOG where EVT IS NULL?DBConnection.getConnection()is not ensuring that ANSI_NULLS is OFF, it is likely that ANSI_NULLS is in fact ON (the default).