Re: Using nulls in a jdbc Select

From: Charles Fineman (cfineman-no&spam_at_yahoo.com)
Date: 03/23/04


Date: Tue, 23 Mar 2004 10:10:10 -0500

Unfortunately i think you can only use ISNULL for this. Sucks if you are
trying to keep around the prepared statement.

Hugh von Kanada wrote:

> Hi all,
> I need to do a select on a nullable column in a database where I
> absolutely must know if this column is null or not. I tried coming up
> with searches that get around it, but there is no way of searching and
> getting the unique results I require without checking this field.
>
> Now, the problem. I'm going against an MS SQL Server 2000 database
> using the Microsoft jdbc driver.
>
> I'm trying to do something like this:
>
> String strSQL = "DELETE FROM ContextDefinitions WHERE CONTEXT_DEF_ID =?
> AND BLOCK_ACT_DEF_ID";
> if (isBlock)
> strSQL += " !=?";
> else
> strSQL += " =?";
>
> stmt = getConnection().prepareStatement(strSQL);
> stmt.setInt(1, iContextId);
> stmt.setNull(2, java.sql.Types.INTEGER);
> int iRowsDel = stmt.executeUpdate();
>
> I can set the null, but then the query doesn't find the row in both the
> case where I set the second item to look for not null or null.
>
> I noticed that when I do the query in the MS SQL query tool, I can't
> locate null columns in a search. What's up with that??
> -Hugh
>



Relevant Pages

  • Re: Using nulls in a jdbc Select
    ... > I need to do a select on a nullable column in a database where I ... > with searches that get around it, but there is no way of searching and ... > I can set the null, but then the query doesn't find the row in both the ... > I noticed that when I do the query in the MS SQL query tool, ...
    (comp.lang.java.databases)
  • Re: Using nulls in a jdbc Select
    ... >> I need to do a select on a nullable column in a database where I ... >> with searches that get around it, but there is no way of searching and ... >> I noticed that when I do the query in the MS SQL query tool, ...
    (comp.lang.java.databases)
  • Re: querying the content database
    ... You need to do a join in your query to get the corresponding information ... last modifying username we need to refer to UserInfo table. ... for content database table schema, ...
    (microsoft.public.sharepoint.windowsservices)
  • Using nulls in a jdbc Select
    ... I need to do a select on a nullable column in a database where I ... with searches that get around it, but there is no way of searching and ... but then the query doesn't find the row in both the ... I noticed that when I do the query in the MS SQL query tool, ...
    (comp.lang.java.databases)
  • DDE connection w/ Access & Word 2007
    ... I have a database that, back in the days when we used Office XP I had no ... I have a parameter query in Access that feeds a Word mail merge. ... I've done some searching and the first suggestion I came across said it was ...
    (microsoft.public.word.mailmerge.fields)