Link to home
Start Free TrialLog in
Avatar of asubbiah
asubbiah

asked on

SSIS : IsDBNull Function is not working as expected

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?
ASKER CERTIFIED SOLUTION
Avatar of GMGenius
GMGenius
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try

if DateOfBirth = "" Then
Trying using ISNULL OR LEN (DateOfBirth) > 1 --- should definetly work
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also try:
If DateOfBirth Is DBNull.Value Then

End If

Open in new window

Please check null or convert null to blank in first query.
PatelAlpesh,

I ma not sure if you noticed, but this question is more than 6 months old and the author appears to be MIA.
I have posted possible solution for this question
I too also gave a good link to assist here. I recomend a split between all contributors
I recommend you award points to:
http:#a33595056
http:#a33602449
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
I agree - all contributors where helpfull