Solved

SSIS : IsDBNull Function is not working as expected

Posted on 2010-09-03
18
991 Views
Last Modified: 2013-11-10
Hi,

Im using SSIS to create a flat file retrieving data from a table. Im using Visual Basic 2008 and SQL server 2008.

I have a Data flow Task inside which i have a OLE DB Source component which retrieves data from a table and sends it to a script component. One of the field that is retrieved from the table is a DateOfBirth Field. It is of datatype "date". When i use IsDBNull(DateOfBirth) in the Script component im getting a "RunTime Error: The column has a null value.".

Why is this happening? Is this a bug in SSIS?
0
Comment
Question by:asubbiah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +4
18 Comments
 
LVL 12

Accepted Solution

by:
GMGenius earned 42 total points
ID: 33595056
There is a really good article that I think might help you here
http://www.mssqltips.com/tip.asp?tip=2028
I think you need ISNULL(DateOfBirth)
 
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 33595063
try

if DateOfBirth = "" Then
0
 
LVL 16

Expert Comment

by:vdr1620
ID: 33596562
Trying using ISNULL OR LEN (DateOfBirth) > 1 --- should definetly work
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 30

Assisted Solution

by:Reza Rad
Reza Rad earned 42 total points
ID: 33602449
you should:
Check the retain null values from the source as null values in the data flow option and then you will get your nulls

this will solve empty values from flat file in ssis problem

reference:
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/b2984e44-c353-4a6d-9761-8a589bcc5063




0
 
LVL 12

Assisted Solution

by:Mohamed Abowarda
Mohamed Abowarda earned 41 total points
ID: 33604029
Try the following:
If DateOfBirth Is Nothing Or DateOfBirth = "" Or Len(DateOfBirth) < 1  Then

End If

Open in new window

0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33604034
Also try:
If DateOfBirth Is DBNull.Value Then

End If

Open in new window

0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 35239735
Please check null or convert null to blank in first query.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 35245711
PatelAlpesh,

I ma not sure if you noticed, but this question is more than 6 months old and the author appears to be MIA.
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35434868
I have posted possible solution for this question
0
 
LVL 12

Expert Comment

by:GMGenius
ID: 35435048
I too also gave a good link to assist here. I recomend a split between all contributors
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 35451205
I recommend you award points to:
http:#a33595056
http:#a33602449
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 35451311
It wouldn't be fair to split point between two experts practiced in the question and posted possible solution while the others not who actually posted possible solutions too.

I recommend closing this question by accepting each possible solution:
http:#33595056
http:#33602449
http:#33604029
0
 
LVL 12

Expert Comment

by:GMGenius
ID: 35452824
I agree - all contributors where helpfull
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question