Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
Don't knock the competition
 
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

21
November

How Do I Add A Null to the Where Clause In list in SQL?

During a recent SQL training course one of the delegates asked "How Do I add Nulls to the In list of values in the SQL Where Clause"?

It is not possible to add a Null as a value in the In list, but there is a work around

Solution:

When using the IN in the Where clause, it has to be an actual value, so one cannot include the Null as a criteria value of the field, when creating the IN array list of values.

To get around this one can use the syntax:

WHERE

(Tablename.Fieldname in (Val1, Val2, Val3, Val4)

OR Tablename.Fieldname IS NULL)


If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us

MAKE A COMMENT

Name *

Email Address *

Comment *

To prove you are human what is:

23 + 8 =