sql server extract - corrupt data when using an odbc stage

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
Rob4732
Premium Member
Premium Member
Posts: 66
Joined: Mon Oct 06, 2008 5:14 pm

sql server extract - corrupt data when using an odbc stage

Post by Rob4732 »

Hello Everyone,

We are connecting to a sql server database with datastage for the first time. The odbc configuration is complete and we are communicating with the database from parallel jobs. When extracting data from a sql server table(via an odbc stage), we noticed that some of the data in nvarchar columns is corrupted in the job(extra garbage after the data). Looks fine in the database, but not in the job. Codeset difference could be to blame. We tried setting datastage codeset to unicode, but still getting bad data.

We are extracting an integer and an nvarchar(see resulting data below):

Data in database:

ID LAST_NM
345 Kraska

Extracting same data in datastage and dumping to sequential file:

ID LAST_NM
345[null][null][null][sub][esc] Kraska[null]T_NM[null][null]

It appears as if part of the column name(T_NM) is in the data. When extracting multiple records, bad data appears to bleed down multiple recs.

DRS stage seems to work fine.

Any ideas appreciated.

Thx

Robert
We don't see things as they are;
We see them as we are.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you read the data successfully if you change the data type to VarChar - possibly with maximum length set up to four times the NVarChar column length specification?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rob4732
Premium Member
Premium Member
Posts: 66
Joined: Mon Oct 06, 2008 5:14 pm

Post by Rob4732 »

I changed the LAST_NAME column from nvarchar 50 to varchar 100 and re ran. Same bad data.

When I change my database stage from ODBC to DRS and run same extract(using nvarchar 50) my data looks good.

ID LAST_NM
345Kraska
We don't see things as they are;
We see them as we are.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

But what happend to the space inbetween the Number and Name?
Is that a special character avaialble in the Database itself?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Rob4732
Premium Member
Premium Member
Posts: 66
Joined: Mon Oct 06, 2008 5:14 pm

Post by Rob4732 »

Sorry, that was my faux pas. I originally typed in the results adding a space to make it clearer.

thx
We don't see things as they are;
We see them as we are.
Post Reply