Solved

SSIS : IsDBNull Function is not working as expected

Posted on 2010-09-03
18
987 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
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.

828 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