Page 1 of 1

Error in inserting records into sqlserver table

Posted: Mon Jun 04, 2007 5:50 am
by sjordery
Hi All,

I am getting errors while inserting records from sequential file to sqlserver table.

My seq file contains data like this
-------------------------------------------------------
name,header_date,start_date,no_of_records

IB,2007-04-16 10:20:30,Apr 16 2007 ,300
-------------------------------------------------------

In the database table the data type of above columns are mentioned below

name varchar(4)fk
header_date datetime
start_date varchar(12)
no_of_records numeric(5,3)

I have taken the metadata in the seq file as below

name varchar(4)
header_date varchar (23)
start_date varchar(12)
no_of_records integer(10)

for header_date column,in the trnasformer stage I have defined the derivation as
StringToTimestamp( input.file_header_date,"%yyyy-%mm-%dd %hh:%nn:%ss")

after running the job I am getting following error
-------------------------------------------------------------------------------------
Dynamic_RDBMS_11,0: Warning: stats_2_insert.Dynamic_RDBMS_11: [DataDirect][ODBC SQL Server Driver][SQL Server]INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_DSS_SOURCE'. The conflict occurred in database 'FIDO', table 'source', column 'name

-------------------------------------------------------------------------------------
in the source table I have value for name column as IB then what this error is pointing to any suggestions?

Posted: Mon Jun 04, 2007 6:15 am
by chulett
I don't really "do" Sql Server, but it just sounds like you've violated a foreign key contraint. Your target table has a FK constraint to another table and a field in your inserted record does not have a matching value in the constraining table. If I had to guess, it's probably the 'name' field and 'IB' doesn't exist in the other table. :?

If you can't figure this out, talk to your DBA. Show them what you are doing and the error message it generates. I'm sure they'd be happy to explain the error of your ways to you. :wink: