dbTalk Databases Forums  

ActiveX Converting Zero Length Strings to Nulls

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


Discuss ActiveX Converting Zero Length Strings to Nulls in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rmcompute
 
Posts: n/a

Default ActiveX Converting Zero Length Strings to Nulls - 10-26-2006 , 06:33 PM






In order to test the data from the source file, I changed the DTS load job to
use an ActiveX script instead of just a copy. I noticed that data with a
zero length string are getting converted to nulls and this is causing an
issue. There is nothing in the command which tells it to do a conversion:

DTSDestination("Segment") = DTSSource("Segment")

Can a default control be set to prevent this from happening or do I have to
change each line of code to something like:

If DTSSource("Segment") = '' Then
''
Else
DTSDestination("Segment") = DTSSource("Segment")
End If



Reply With Quote
  #2  
Old   
Jay
 
Posts: n/a

Default Re: ActiveX Converting Zero Length Strings to Nulls - 10-27-2006 , 02:37 PM






I've encountered that issue as well. I'm pretty sure you have to code
(as you did below) to handle the zero length strings.

One thing to keep the amount of code down you could use:

DTSDestination("Segment") = IIF(DTSSource("Segment") = "",
"",DTSSource("Segment") )

Not always the easiet code to read, but it reduces the lines of code
written.


Jay

rmcompute wrote:
Quote:
In order to test the data from the source file, I changed the DTS load job to
use an ActiveX script instead of just a copy. I noticed that data with a
zero length string are getting converted to nulls and this is causing an
issue. There is nothing in the command which tells it to do a conversion:

DTSDestination("Segment") = DTSSource("Segment")

Can a default control be set to prevent this from happening or do I have to
change each line of code to something like:

If DTSSource("Segment") = '' Then
''
Else
DTSDestination("Segment") = DTSSource("Segment")
End If


Reply With Quote
  #3  
Old   
rmcompute
 
Posts: n/a

Default Re: ActiveX Converting Zero Length Strings to Nulls - 10-28-2006 , 11:52 AM



Glad to hear I am not the only one experiencing this. One thing, I tried the
code listed below and got this error:

VBScript runtime error Type mismatch: IIF.

The IF End If statement works with this particular field. Are you sure the
IIF statement is valid in this context ?

Thanks.

"Jay" wrote:

Quote:
I've encountered that issue as well. I'm pretty sure you have to code
(as you did below) to handle the zero length strings.

One thing to keep the amount of code down you could use:

DTSDestination("Segment") = IIF(DTSSource("Segment") = "",
"",DTSSource("Segment") )

Not always the easiet code to read, but it reduces the lines of code
written.


Jay

rmcompute wrote:
In order to test the data from the source file, I changed the DTS load job to
use an ActiveX script instead of just a copy. I noticed that data with a
zero length string are getting converted to nulls and this is causing an
issue. There is nothing in the command which tells it to do a conversion:

DTSDestination("Segment") = DTSSource("Segment")

Can a default control be set to prevent this from happening or do I have to
change each line of code to something like:

If DTSSource("Segment") = '' Then
''
Else
DTSDestination("Segment") = DTSSource("Segment")
End If



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.