TeraData XML datatype

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

TeraData XML datatype

Post by bicap »

I am using Db2 connector as source, copy stage, Teradata connector as Target stage.

In Teradata connector stage:
Load type : Immediate
Enabled LOB reference.
XML column is defined as LongNVarchar(2097088000) both in source & target stage.
When I load data the xml content is loading as character set.
< is replaced by &lt , > is replaced by &gt.
Do we have any steps need to take care in order to load xml content properly. ?
major
Premium Member
Premium Member
Posts: 167
Joined: Mon Nov 26, 2007 12:21 am

Post by major »

Before loading the xml into Teradata, try to write into a file and see.

If everything is ok, change the data element in the meta data as 'XML'.

Thanks
major
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

In case there was a question on certain symbols getting replaced, there are 5 invalid XML characters that must be escaped when in the data, in order to have proper XML content. Examples:

Code: Select all

>   >
<   <
&   &
'   &apos;
"   "
Hopefully the source XML column has already been validated and you're good to go.
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And then as noted, setting the Data Element to XML tells it that it is already XML and to leave it alone as it passed through.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

The column is defined as XML in both source & target database, but in datastage meta, if we import, it was coming as UNKNOWN -370; So we changed to LongNVarchar(2097088000).
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Note that we're not discussing the data type here but rather a property called data element. It's in the documentation and has been discussed in the forums here, for example in this post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

When I choose the Data Element as XML , then it was throwing error as "the data element selected is not compatible with the SQL data type".

So, now the issue is when I edit the xml file in note pad , every thing looks good , but the spaces are stripped , making the xml content as long string.
Post Reply