SQL server 2008 Date to Char question

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

SQL server 2008 Date to Char question

Post by JPalatianos »

Hi,
The development team is bringing in a timestamp from SQL server 2008 as
2011-05-05 00:00:00.000 and they need to just grab the date portion as 2011-05-05.

The result needs to be inserted into SQl server 2008 as a date field. I've tried changing their sql to bring the date in as a Character field but then get the following error
CFF_POPULATE_STG_TABLE_NEW_CS_ID_JPTEST..odbcCFFStTable.outStagingData: DSD.BCIOpenW results of SQLColAttributes(eff_dt) gave MetaData mismatch
COLUMN.TYPE Expected = Date Actual =

Any suggestions?
Thanks - - John
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

Post by JPalatianos »

Some more info....when I bring the date in as a time stamp and then try inserting I receive teh following warning:

Is their a function I can use in the transformer to give me the
2011-05-05 of the eff_dt field currently 2011-05-05 00:00:00.000


Server:NJROS1BBLA0704
Project:CFF
Job No:36
Job name:CFF_POPULATE_STG_TABLE_NEW_CS_ID
Invocation:
Event Number:5496
Event type:Warning
User:PRUDENTIAL\X090842
Timestamp:1/3/2011 11:08:20 AM
Message Id:-1
Message:
CFF_POPULATE_STG_TABLE_NEW_CS_ID..xfmNBSStoCFF.outStagingData: DSD.BCIPut call to SQLExecute failed.
SQL statement:INSERT INTO cff_dev.cffstg.data_src_cshflow_forcst_stg(data_src_sys_cd, seg_cd, prodt_cd, acty_cd, forcst_id, eff_dt, csh_flow_amt, data_src_as_of_dt) VALUES (?,?,?,?,?,?,?,?)
SQLSTATE=01004, DBMS.CODE=0
[DataStage][SQL Client]Data has been truncated
SQLSTATE=22008, DBMS.CODE=241
[DataStage][SQL Client][ODBC][IBM (DataDirect OEM) ][ODBC SQL Server Driver][SQL Server]Conversion failed when converting date and/or time from character string.

data_src_sys_cd = "NBSS"
seg_cd = "INDIVSS"
prodt_cd = "SS"
acty_cd = "KNWNSALE"
forcst_id = "200000011737"
eff_dt = 2011-05-05 00:00:00.000
csh_flow_amt = 840.0000
data_src_as_of_dt = 2011-05-05
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Expected=Date,Actual=
suggests that the data type is not given in the column definition in your job (or in the database).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

Post by JPalatianos »

After looking at their job a bit more, It looks like it may be an issue with SQL server 2008 "Date" type. When we import the medadata the column definition comes in as NVarChar. Since we do not have NLS installed we cannot use this and anything else we try gives a conversion error writing to the target table. I have contacted IBM to see if they have an updated ODBC driver or any suggestions for us. I will update the post once I hear anything.
Thanks - - John
cppwiz
Participant
Posts: 135
Joined: Tue Sep 04, 2007 11:27 am

Post by cppwiz »

Yes, this is an issue with the DataDirect drivers in the Datastage 8.1 release. You can find out more about this known issue by searching this web site:

http://knowledgebase.datadirect.com/

There is an upgrade to the DataDirect 6.0 drivers available on the IBM FixCentral web site which will resolve this issue.
Post Reply