x

SSIS Null value for Integers

Hi ,

I am trying to load data from a flatfile to SQL Table. I have a condition where if there are blank values for fields then I have to upload null in the tables and if there are values then i need to convert them to integer and upload to the tables.

I was using data conversion task but can any one suggest how to handle the null value in derived column.

Thanks, Kannan
more ▼

asked Jan 05, 2012 at 03:00 AM in Default

aRookieBIdev gravatar image

aRookieBIdev
2.3k 48 56 61

(comments are locked)
10|1200 characters needed characters left

1 answer: sort newest

I guess you can use the expression in the derived column something like

TRIM([YOURSTRINGFIELD]) == "" ? NULL(DT_NUMERIC, «precision», «scale») : (DT_NUMERIC, «precision», «scale»)[YOURSTRINGFIELD]
more ▼

answered Jan 05, 2012 at 03:30 AM

Usman Butt gravatar image

Usman Butt
13.9k 6 8 14

Hi thanks for your reply , I tried this but I was able to insert only 0 , but i need null values in my db tables.
Jan 06, 2012 at 04:43 AM aRookieBIdev
Sorry about it . What u suggested works fine, Thanks again
Jan 06, 2012 at 05:10 AM aRookieBIdev
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x937
x31
x29
x11

asked: Jan 05, 2012 at 03:00 AM

Seen: 2101 times

Last Updated: Jan 05, 2012 at 03:00 AM