亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 開發 > 綜合 > 正文

[轉]How to handle Failed Rows in a Data Flow

2024-07-21 02:50:48
字體:
來源:轉載
供稿:網友
[轉]How to handle Failed Rows in a Data Flow

本文轉自:http://www.rad.pasfu.com/index.php?/archives/23-How-to-handle-Failed-Rows-in-a-Data-Flow.html

suppose this scenario:

you have a source table and a destination table, you want to transfer rows from source table to destination table, so you can use simple data flow with OLE DB source and OLE DB Destination. but PRoblem hits when destination table has few rows inside, and there is Unique Constraint in ID field of Destination table. in this situation your data flow will fail, because when OLE DB Destination want to insert rows in destination table, it will got Unique Constraint error and it will raise Data Flow error, and this will prevent OLE DB Destination to insert any rows in table, even rows which hasn't equivalent key in destination !So, a work around needed here to avoid failing package and only move rows which hasn't problem with unique constraint in destination table.let me explain it with a sample here...

create source table with this script:

CREATE TABLE [dbo].[SourceFailureTable]( [ID] [int] IDENTITY(1,1) NOT NULL, [name] [varchar](50) NULL,CONSTRAINT [PK_SourceFailureTable] PRIMARY KEY CLUSTERED( [ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY] and fill it with this data: now create destination table with this structure:

CREATE TABLE [dbo].[DestinationFailureTable]( [ID] [int] NOT NULL, [name] [varchar](50) NULL, CONSTRAINT [PK_DestinationFailureTable] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]Note that DestinationFialureTable, has a Primary Key on ID filed, primary key is basically a Unique Constraint. so this constriant will check IDs to be unique , and if an insertion tends to insert not unique value in ID field this will cause Unique Constraint Error.fill Destination with these three fields:

we want to import rows from SourceFailureTable to DestinationFailureTable. Create simple Data flow task, with an OLE DB Source, connected to SourceFailureTable. and an OLE DB Destination connected to DestinationFailureTable. map the columns too. now every time you run this package you will got error: error description: "Violation of PRIMARY KEY constraint 'PK_DestinationFailureTable'. Cannot insert duplicate key in object 'dbo.DestinationFailureTable'."and none of ten rows in Source table moved to destination table. even rows with IDs like 1 , 2, 4 ,.. whichnot exists in the destination table.So, What we can do? right click on OLE DB Destination, select properties window. find accessMode in properties, you can see that the AccessMode value is OpenRowSet using FastLoad. this will cause that all records from input insert with a fast load transaction at one time. so this will cause error. Change AccessMode to OpenRowSet. this will try to insert row by row. Note that this is not good option when you insert large amount of records because insertion with fast load has better performance, but in this sample I just want to show you how to handle failed rows in insert. after chaning AccessMode to OpenRowSet , run package again, you will see the error happens again with no luck. but difference is here in the destination table:

in the destination table two new rows inserted , rows with ID 1 and 2. but no more rows. the meaning of this behaviour is that OLE DB Destinaion tried to insert row by row into the DestinationFailureTable, first two rows inserted successfully. but for third row it got unique constraint error again and cause package to fails. and failing the package stops other rows transformation.So you should handle rows which cause Error. this is the time whenFailure Error Outputcomes to help. first delete rows with ID 1 and 2 from DestinationFailureTable manually. and then add another table named FailedRows with this structure:

CREATE TABLE [dbo].[FailedRows]( [ID] [int] NULL, [name] [varchar](50) NULL) we want to move rows which cause error to this table.now add another OLE DB Destination in data flow , right after DestinationFailureTable . and connect RED ARROW to it. when you connect this arrow, a Configure Error Output window will appear. look at this screenshot:

there are three options for Error property in this window:

Ignore Failure will ignore any errors during insertion of records to destination Redirect Row will redirect any rows which cause error during insertion to destination Fail Component will cause to fail component when insertion hits any errorby default this option set to Fail Component. so when you got an error during insertion the whole OLE DB Destination will fail. Set the Error as Redirect row. this will cause every rows which cause error ( means BAD rows ) to redirect to new OLE DB Destination. now hit ok. and double click on new OLE DB Destination let's name it FailedRows. connect this to failed rows. and map the columns like below:

Note that there are two new columns in mapping page, ErrorCode and ErrorColumn. these are auto generated rows by Failure Error Output and will show code and column number of error. we don't need them in this sample. so just map ID and name.now run the package. you will see that there are 10 rows transfered from SourceFailureTable to DestinationFailureTable, but there are only 3 rows transfered to FailedRows. this means that there are 3 rows exists in DestiantionFailureTable which prevent equivalent values in SourceFailureTable to be inserted . so these rows transfered to FailedRows Table. this is full schema of package:

and look at results in DestinationFailureTable:

there are 7 new rows in this table.and this is results in FailedRows Table:

there are 3 rows which cause unique constraint failure transfered to this table.This was a sample of how to use failure error output in SSIS. hope to solve your issues in this area.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
最近2019年手机中文字幕| 97人洗澡人人免费公开视频碰碰碰| 欧美日韩亚洲精品一区二区三区| 岛国精品视频在线播放| 日韩精品视频中文在线观看| 日韩极品精品视频免费观看| xx视频.9999.com| 中文字幕日韩欧美精品在线观看| 色综久久综合桃花网| 国产精品揄拍一区二区| 国产欧美日韩精品专区| 亚洲欧美日韩一区二区三区在线| 亚洲午夜国产成人av电影男同| 亚洲人成在线免费观看| 亚洲国语精品自产拍在线观看| 中文字幕久久久av一区| 亚洲一区二区福利| 在线播放日韩欧美| 国产精品香蕉国产| 欧美亚洲视频在线看网址| 国产精品91视频| 日韩av网址在线| 久久免费观看视频| 啪一啪鲁一鲁2019在线视频| 国产精欧美一区二区三区| www.亚洲成人| 亚洲美女视频网| 国产精品小说在线| 中文字幕亚洲综合久久筱田步美| 91精品久久久久久久久不口人| 国产精品视频成人| 国产成人精品网站| 最近2019年日本中文免费字幕| 亚洲一区二区三区乱码aⅴ| 亚洲欧美日韩中文视频| 亚洲黄色av网站| 在线观看国产成人av片| 成人美女免费网站视频| 91精品中国老女人| 欧洲亚洲免费在线| 日韩国产激情在线| 日韩av一区二区在线| 久久91亚洲人成电影网站| 久久久久女教师免费一区| 91亚洲精品久久久| 中文精品99久久国产香蕉| 亚洲一区二区久久久久久久| 91精品国产91久久久久久| 欧美一级大片在线免费观看| 久久精品国产综合| 国产精品爽黄69天堂a| 欧美中文在线观看| 欧美—级a级欧美特级ar全黄| 欧美性xxxxxxxxx| 欧美久久久精品| 亚洲日本欧美中文幕| 性视频1819p久久| 久久久久国产精品一区| 日韩av电影免费观看高清| 欧美激情精品久久久久| 亚洲一区中文字幕在线观看| 亚洲国产精品免费| 亚洲黄页视频免费观看| 久久99久国产精品黄毛片入口| 精品福利在线看| 在线国产精品播放| 欧美日韩亚洲激情| 亚洲精品福利在线观看| 色999日韩欧美国产| 国产精品免费久久久久影院| 亚洲色图50p| 91精品国产色综合| 日本精品久久中文字幕佐佐木| 在线观看国产欧美| 亚洲国产精品中文| 亚洲精品久久久久中文字幕二区| 97av在线视频免费播放| 亚洲欧美国产日韩天堂区| 日韩av一区二区在线观看| 中文字幕成人在线| 久久这里只有精品视频首页| 日韩中文第一页| 色偷偷88888欧美精品久久久| 久久激情视频免费观看| 中文字幕一区二区三区电影| 91亚洲人电影| 韩剧1988在线观看免费完整版| 久久av.com| 国产精品美女久久久久av超清| 久久亚洲国产成人| 97超级碰碰碰久久久| 亚洲美女自拍视频| 国产日韩精品在线观看| 午夜精品久久久久久久白皮肤| 国内精品小视频在线观看| 成人美女免费网站视频| 亚洲一区二区三区成人在线视频精品| 日韩国产激情在线| 51精品在线观看| 日韩网站免费观看| 亚洲欧美日韩爽爽影院| 久久久久久久久久av| 欧美视频一区二区三区…| 精品香蕉一区二区三区| 日韩精品福利网站| 91久久精品国产91久久| 欧美性色19p| 日韩成人黄色av| 亚洲天堂精品在线| 91久久精品国产91久久| 久久网福利资源网站| 欧美激情精品久久久久久| 亚洲一区二区久久久久久久| 精品久久久久久久久久ntr影视| 国产第一区电影| 26uuu国产精品视频| 91亚洲国产成人久久精品网站| 韩国国内大量揄拍精品视频| 91亚洲国产成人久久精品网站| 亚洲欧洲中文天堂| 亚洲人成在线观看网站高清| 国产精品爱久久久久久久| 亚洲国产精久久久久久久| 亚洲91精品在线| 日韩一级裸体免费视频| 亚洲人成网站免费播放| 亚洲国产精品va在线看黑人| 久久久精品国产亚洲| 日韩精品免费在线视频| 九九热精品在线| 奇米一区二区三区四区久久| 亚洲iv一区二区三区| 久久99久久99精品免观看粉嫩| 欧美在线免费视频| 国产精品视频资源| 色噜噜亚洲精品中文字幕| 亚洲激情视频在线播放| 久久亚洲欧美日韩精品专区| 热久久美女精品天天吊色| 日韩国产高清视频在线| …久久精品99久久香蕉国产| 亚洲成人免费在线视频| 色与欲影视天天看综合网| 精品人伦一区二区三区蜜桃网站| 亚洲第一福利在线观看| 全球成人中文在线| 亚洲国产91精品在线观看| 亚洲夜晚福利在线观看| 精品亚洲男同gayvideo网站| 亚洲精品自产拍| 欧美日韩精品在线视频| 成人a级免费视频| 国产日韩亚洲欧美| 中文字幕成人精品久久不卡| www日韩中文字幕在线看| 黑人巨大精品欧美一区二区免费| zzjj国产精品一区二区| 国产一区二区视频在线观看| 欧美极品欧美精品欧美视频| 欧美性猛交xxxx| 动漫精品一区二区| 中文国产成人精品| 日韩va亚洲va欧洲va国产| 日韩av综合网站|