Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Integration Services / July 2008

Tip: Looking for answers? Try searching our database.

Derived Column Transformation Editor - How to replace NULL character?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
serge - 03 Jul 2008 04:48 GMT
I am trying to import a text file which exists a column that has some NULL
values.
I am unable to import the data and have this NULL not report an error.

I tried writing the following expression in the Derived Column
Transformation Editor:
   REPLACE(myColumn, HEX(00),"")

Is there a way to import a NULL value and not get any errors?

Thank you
jhofmeyr@googlemail.com - 03 Jul 2008 11:45 GMT
Hi Serge,

Try: IsNull(myColumn) ? "" : myColumn

Good luck!
J
Joe H - 03 Jul 2008 16:31 GMT
Here is a snip of ine of mine - if ISNULL replace with "N/A" else use
ProgramIndexDescription

ISNULL(ProgramIndexDescription) ? "N/A" : ProgramIndexDescription

>I am trying to import a text file which exists a column that has some NULL
>values.
[quoted text clipped - 7 lines]
>
> Thank you
jhofmeyr@googlemail.com - 07 Jul 2008 14:12 GMT
<quote>
... replace with "N/A" ...
</quote>

Different strokes for different folks ;)

I usually use empty string ("") because if the destination is a
delimited flat file, most systems that read the file will interpret
empty-string as a NULL.  If the destination is a database, I'll
usually leave the column as NULL in the first place and leave the
defaulting to the database (create constraint on the column).

It all depends on your data integrity requirements.  "N/A" (and indeed
"") actually mean something, whereas NULL means the value does not
exist ...

Good luck!
J
Joe H - 07 Jul 2008 16:57 GMT
My target table is a Datat Warehouse table.  All columns have to have a
bucket to go into so the counts work correctly.  Blank or null values go
into the "N/A" bucket.

> <quote>
> ... replace with "N/A" ...
[quoted text clipped - 14 lines]
> Good luck!
> J
jhofmeyr@googlemail.com - 07 Jul 2008 19:10 GMT
Yeah, defaulting is pretty standard in data warehousing, but you still
need to be careful how it is done ... blank != null != N/A (although
to be fair many businesses count them as the same for practical
purposes)  It's the same concept as defaulting null numbers to 0 -
this is risky as it throws out any aggregation based on a count of
values (avg's, mean's, median's, etc)

Defaulting in the database means that you don't have to worry about
ensuring consistent defaulting in each of your ETL processes.

Just my opinion ;)
J
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.