Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003

    Exclamation Unanswered: Running a sql to find blanks or empty space in database

    I am trying to run a sql to find if any of my fields have a empty or blank space.

    Is there anyway we can list such rows and count

    Thanks in advance

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Yes, you can do it.

    A lot depends on how you define "empty or blank space" and which database engine you are using. Assuming that your database engine does standard SQL compares (right side string promotion), I'd suggest something like:
    SELECT *
       FROM myTable
       WHERE  myColumn IS  NULL OR '' = myColumn OR myColumn = ' '

  3. #3
    Join Date
    Dec 2003

    Question blanks for numeric fields

    In am using sybase and part of unit testing my application,
    I need to see how many blank spaces exist in db.

    Especially for fields which have been defined as numeric.
    Your query is good for fields defined as characters. Many times we come across db where numeric fields have blanks neither 'NULL' or '0'.

    Please do let me know if you have any solution for that.

  4. #4
    Join Date
    Apr 2002
    Toronto, Canada
    i'm not sure how to tell you this, but "fields which have been defined as numeric" cannot have blanks or spaces in them

    unless sybase is really a lot different than i thought it was | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Apr 2004
    Kansas City, MO
    Wouldn't that make life interesting. Maybe we could also have a stateless value. hmmmm
    When life gives you a lemon, fire the DBA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts