dbTalk Databases Forums  

"DateTime string" transformation - handling NULLs

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss "DateTime string" transformation - handling NULLs in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nils Magnus Englund
 
Posts: n/a

Default "DateTime string" transformation - handling NULLs - 05-06-2004 , 03:45 PM






Hi!

I'm transforming data from a SQL Server to another, what is a CHAR(10) in
one table is a DATETIME in the other. The format of the string is
YYYY-MM-DD, and this is handled excellent by DTS as long as the string has a
value. However, when the string is empty (10 spaces), I want to put a NULL
value in the DATETIME column. I only get an error when I try now. What do I
do to make it treat empty strings as a NULL for the DATETIME column?


Sincerely,
Nils Magnus Englund



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: "DateTime string" transformation - handling NULLs - 05-07-2004 , 03:20 AM






Does this do it. This should be placed in your SourceSQLStatement.

NULLIF(<attribute name>,' ')

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Nils Magnus Englund" <nils.magnus.englund (AT) orkfin (DOT) no> wrote

Quote:
Hi!

I'm transforming data from a SQL Server to another, what is a CHAR(10) in
one table is a DATETIME in the other. The format of the string is
YYYY-MM-DD, and this is handled excellent by DTS as long as the string has
a
value. However, when the string is empty (10 spaces), I want to put a NULL
value in the DATETIME column. I only get an error when I try now. What do
I
do to make it treat empty strings as a NULL for the DATETIME column?


Sincerely,
Nils Magnus Englund





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.