Solved

SSIS : IsDBNull Function is not working as expected

Posted on 2010-09-03
18
997 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

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.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

626 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