datetime loading differently in sqlserver database

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
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

datetime loading differently in sqlserver database

Post by reddy12 »

gurus,

i have a job that loads a sqlserver table.

i have Oracle Enterprise ---->Transformer----->Odbc Connector.

i am loading a table in Sqlserver using Odbc connector.

during the load process i have oracle date filed which i am reading as a timestamp and loading as a timestamp to sql server ie. as datetime in sqlserver table.

it is loading fine except the date 2007-12-31 14:29:29
it loads as 2008-12-31 14:29:29.000

any ideas why is it loading 2007 as 2008??.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, I don't see how that could be. Double-check that that is really what is happening. What is your derivation for the field? Generated or user-defined sql?
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

Tanks for your response.

uses generated sql statement.
and in transformer derivation i just mapped from timestamp to timestamp.

nothing else..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Oracle will generate a TO_CHAR(YourField,'YYYY-MM-DD HH24:MI:SS') in your source SQL for a timestamp, what does SQL Server generate on the isert side? Regardless, I still don't see how it can get the year wrong. For one date. :?

ps. Thanks, I like tanks. Panzerkampfwagen VI Ausf. B, baby! :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

Thanks!!!!

to test here is what i did

i selected the data from oracle table like this
select * from table_name where load_date = to_date('2007-12-31 14:29:29','yyyy-mm-dd hh24:mi:ss')

and in transformer mapped to odbc and to a peak..

the specific column is loaded as 2008-12-31 14:29:29.000 in sql server and to peak it is written as 2007-12-31 14:29:29
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... a couple of points. That's not generated sql if it literally says 'select *' in it. Without any sort of conversion coming out of Oracle, that will select an internal Oracle numeric value AFAIK, so in my mind all bets are off with regards to what SQL Server will do to it. And you didn't post the ODBC sql, does it 'wrapper' it at all in any kind of function or does it just send it over unmolested?

And a 'peek' stage means a PX job, not Server as you marked your first post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

my bad,
when starting to write a post i selected parallel only ..some how wrong selection...
job is parallel..

here is the generated sql on SQLSERVER side..

ODBC_Connector_1,0: [IIS-CONN-ODBC-000105] Connected to Microsoft SQL Server, version 09.00.57867 through driver VMmsss22.so.
[IIS-CONN-ODBC-000099] The driver does not support quoted identifiers in SQL statements
[IIS-CONN-DAAPI-000361] Generated INSERT statement: INSERT INTO table_name(LOAD_DATE) VALUES(ORCHESTRATE.LOAD_DATE)


Regards
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... well, my gun is empty at this point as I'm not that familiar with ins and outs of SQL Server. Hopefully someone else can chime in. That or ping your official support provider and let us know what they have to add.
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

now i am testing with odbc enterprise stage instead of odbc connector..
i should update with the result..

thanks anyway..
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

odbc enterprise stage loads normally..

Thanks.
Post Reply