Showing posts with label NULL. Show all posts
Showing posts with label NULL. Show all posts

Thursday, 6 August 2015

NULL with NOT IN () caluse

Most of you must be aware of the fact that NULL value causes more problem than anything else database world. Well here is an example which may or already have ruined few minutes @m some point in your career.

NULL means nothing then Why on the earth should we care about it ? well it is one of the most important thing that DB developer should care or you'd be doomed for unexpected results.

Let's see one example of NULL causing few of us headache.. 

Monday, 13 April 2015

SQL script to list columns with NULL values for all the records

Recently, my client asked me to give him the list of columns which have NULL value for all the records of that Table. This has to be done on the CRM database.

There might be better ways to fetch this information but this is what I did


  • Find out total number of rows present in concerned table
  • List the columns without NOT NULL constraint
  • Loop over this column list using cursor by substituting it in Count(column name) in a dynamic query

bloggerwidgets