resultset is single blank!

  • Is anyone of you experience that your resultset is blank but in your where condition you have NOT NULL and <> ''.

    I tried sp_dbcmptlevel

    The current compatibility level is 80.

    any ideas? or solutions to remove them?

  • Maybe it's just a carriage return. Can you post the whole query so we can check it out?

  • select * from dbo.SAME_NAME_DOB_GENDER

    where name is not NULL and name <> ''

  • What are you expecting the results to be ? When you say "blank", do you mean an empty result set (no rows returned) or there are blanks in the returned rows ?

    What do diagnostic record counts show ?

    ie:

    select count(*) As CountNull from dbo.SAME_NAME_DOB_GENDER

    where name is NULL

    select count(*) As CountBlank from dbo.SAME_NAME_DOB_GENDER

    where name = ''

    select count(*) As CountAll from dbo.SAME_NAME_DOB_GENDER

  • there are blanks in the returned rows!

    What do diagnostic record counts show

    ie:

    select count(*) As CountNull from dbo.SAME_NAME_DOB_GENDER

    where name is NULL

    0 row

    select count(*) As CountBlank from dbo.SAME_NAME_DOB_GENDER

    where name = ''

    43 rows

    select count(*) As CountAll from dbo.SAME_NAME_DOB_GENDER

    6904 rows

  • If I understand you correctly, you are saying something like, row one has values, row two has values, row three is blank, row four through 20 has values.... etc? 

    Or, are you getting one row returned that is blank? 

    I wasn't born stupid - I had to study.

  • e.g. Result below

    Country      Zip              

    1
    1
    1
    2
    2
    2
    2
    2
    1
    1
    1
    1
    2
    2
    1
    1
    2
    2
    2
    2
    1
    1
    1
    2
    2
    2
    2
    2
    2
    1
    1
    1
    2
    2
    2
    ?1
    ?1
    ?1
    ?1
    ?1
    ?2
    ?2
    ?2
    ?2
    ?2
    1
    1
    2
    2
    2
    2
    2
    2
    american1
    AMERICAN1
    AMERICAN1
  • I suggest at this point you take a step back and concisely describe exactly what the problem is.

    If there are blank column values in the resultset, that would imply the table contains empty strings in those columns. Is that a problem ? You tell us ...

  • I agree with PW.  For instance, your original code was:

    select * from dbo.SAME_NAME_DOB_GENDER

    where name is not NULL and name <> ''

    Where is Name in your output? 

    I wasn't born stupid - I had to study.

  • yes, it is a problem that the resultset is having blank column values! I want to remove those blank values in my resultset.

    Any ideas how to remove them?

    i used NOT NULL and <> '', didn't work!

  • my result there is just an example.

    you can assume that the name same with country

    name = country

  • How do you know it's an empty string in the resultset, and not 1 or more spaces ?

    '' <> ' ' <> '       '

    Try trimming Conutry, so that empty strings, or strings of 1 or more spaces get eliminated:

    Where country Is Not Null And Rtrim(Country) <> ''

     

     

  • I tried Rtrim, still no luck!

  • Maybe try SELECT LEN( Name), Name dbo.SAME_NAME_DOB_GENDER and see it some other character is actually in that field....

    I wasn't born stupid - I had to study.

  • I tried that...

    some len is 2, some len is 4, etc...

    any solutions?

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

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