locked
How can we get rid of rows with blank column values? RRS feed

  • Question

  • Hi, experts here,

     

    I just encounter  a problem with incomming rows which have neither NULL nor valid values for a particular column, it just leaves as blank there, what is that?(which is very annoying) And how can we get rid of rows with this blank values on a particular column?

     

    Thank you very much and I am looking forward to hearing from you shortly.

     

    With best regards,

    Yours sincerley,

     

    Friday, April 4, 2008 1:33 PM

Answers

  • Hi,

    Thank you for your kind suggestion.

    I am on SQL SERVER 2005.

    I have just figured it out that in order to get rid of rows with blank values just use the condition: column_name!='' which will get rid of both NULL and BLANK values for me.

     

    Regards,

     

     

    Friday, April 4, 2008 2:33 PM

All replies

  • Hi,

    Thank you for your kind suggestion.

    I am on SQL SERVER 2005.

    I have just figured it out that in order to get rid of rows with blank values just use the condition: column_name!='' which will get rid of both NULL and BLANK values for me.

     

    Regards,

     

     

    Friday, April 4, 2008 2:33 PM
  • That will only get rid of rows with empty string as a value.  It will not get rid of NULL's.  If you want to get rid of nulls you would say column_name IS NULL.

    select * from table where column_name IS NULL.

    Good article on NULL usage in queries here.

    http://www.sqlservercentral.com/articles/Basic+Querying/understandingthedifferencebetweenisnull/871/
    Friday, April 4, 2008 2:44 PM
  • Hiya,

     

    I am not sure how you have got this result.

    I am on SQL SERVER 2005 and I have tested my query and both NULL and empty strings are all got rid of by condition column_name!=''.

     

    Please test it if you want to see it works on SQL Server 2005.

     

    Regards,

     

     

     

     

     

    Friday, April 4, 2008 9:09 PM