dbTalk Databases Forums  

how to discard rows of a text file which does not satisfies foreign key constraint and continue with the rest

comp.databases.mysql comp.databases.mysql


Discuss how to discard rows of a text file which does not satisfies foreign key constraint and continue with the rest in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Devi
 
Posts: n/a

Default how to discard rows of a text file which does not satisfies foreign key constraint and continue with the rest - 09-26-2006 , 12:35 AM






Hi All,

I am loading data to a child table from a text file. the text files
also contains data not referenced by parent key. while loading the data
if one row fails to satisfies the constraint everything is getting
rollback..

plz suggest me something.. which will help me to discard the
unsatisfied rows and continue with the rest..

My Query:
LOAD DATA CONCURRENT INFILE
'/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_exec.dat'
INTO TABLE CS_COMMON_SHELL_EXEC_REG FIELDS TERMINATED BY '#'
(reg_id,func_address);

Error Msg:
ERROR 1452 (23000): Cannot add or update a child row: a foreign key
constraint fails (`sourcecov/CS_COMMON_SHELL_EXEC_REG`, CONSTRAINT
`CS_COMMON_SHELL_EXEC_REG_ibfk_2` FOREIGN KEY (`func_address`)
REFERENCES `CS_COMMON_SHELL_EXEC` (`func_address`))

Thanks
Devi.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.