Solved

SSIS : IsDBNull Function is not working as expected

Posted on 2010-09-03
18
976 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now