null vs IS NOT NULL

  • I have a table with one column called open filled with some data but there are some cell which are null(blank), I want to run a query

    to get only the open column with data without getting the null.

    I try this open IS NOT NULL but I am still geting some null values.

    Any help

  • Please show the query, table DDL and sample data

  • Maybe you are getting blanks, not NULL .... they are not the same

    try:

    where open > ''

  • Homebrew

    I tried Open > " and it turn to Open > '""'. But it did not work

    I am still getting null value

    my query is simple

    select open from view_rpt

    where open is not null

    I just dont want the blank cells in the column or row.

    Thanks

  • Blank and null are not the same.

    Can you maybe attach a screenshot that shows the data?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • This is how it looks like.

    Open

    NULL

    R252

    R253

    NULL

  • Are any rows returned by the following?

    ... WHERE Open = 'NULL'

    ... WHERE Open IS NULL

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Some rows are returning NULL and I don't need

    the rows with NULL to be returned.

  • I have a column that looks like this

    Open

    NULL

    R252

    R253

    NULL

    or

    Openid open

    r252 abc

    cde

    r253 ghi

    jkl

    I want to get rid of the blank openID

    in my query I try using IS NOT NULL but that doesnt work

    any help

  • Does this return something?

    select open

    from view_rpt

    where open = 'null'

    I suspect that application might be storing 'NULL' and not NULL.

  • Are the "missing" ones NULL or empty string? have you tried something like

    Where IsNull(open, '') <> ''

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • I have come a cross this code below

    =IIF(IsNothing(Fields!Product.Value),"NO","YES")

    Instead of returning both no and yes, I want only yes but

    with the open_id

  • That is not T-SQL.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Please show some sample data and explain what you are trying to do. Your explanation of what you need and what is happening is lacking details. Write more information about what doesn't work.

    If the IIF code is not related to the NULL question, start a new thread. Don't continue to use this one as a catch all for all issues you have.

  • Oh ok maybe that is why a simple query is turning into something big.

    Thanks

Viewing 15 posts - 1 through 15 (of 28 total)

You must be logged in to reply to this topic. Login to reply