sql server - How to add an extra column to handle error message in a SSIS data flow? -
i'm working on ssis project in order import calls rows (excel file) in sql server database.
here data flow :
i added lookups check rows before import process. first 1 checks if row exists (made prevent duplicates because user drag & drop import files in specified folder). others lookups check foreign keys constraints. moreover, no matching rows redirected database. i'm able check invalid rows, audit package let me know if nomatchingrowscall table changed during inport.
now, add "error message" no matching rows check "what problem row ?". think add "derived column after each lookup (no matching output) add error message. way ? how add text content in "derived column" ? should use package variable ?
here :
id | c1 | c2 | c3 | error_message 1 | .. | .. | .. | row exists 2 | .. | .. | .. | fk error column c1 3 | .. | .. | .. | fk error column c2 ...
i want "soft" solution track failing rows without stop package execution, , able manually insert failing row if needed changing failing keys.
adding derived error_message column against each no match output give looking for. in current design, can type in error message against each derived column there 1 derived column component per stream. there no need add variables unless want reuse values else or have messages in centralised place
a couple of warnings though...
- lookups inherently expensive perform row row queries. if dealing small number of rows / small table may fine, if looking @ millions of rows, hit bottle neck. 1 way around temporarily put data database , perform entire set checks (e.g. select x don't have related y row using left join). way, letting sql perform leg work in batch quicker
- your current design highlight first issue. once you've resolved "no employee issue", same row may have date mismatch. ideally want validate rows issues (with exception of duplicate rows) have complete set of issues resolve. if decide switch on using sql validate, maybe add bit flag column per issue type or single column wise bitwise flag covering issues
Comments
Post a Comment