Wednesday, March 28, 2012

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 advanceYes, 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 = ' '-PatP|||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.|||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|||Wouldn't that make life interesting. Maybe we could also have a stateless value. hmmmm

No comments:

Post a Comment