我试图修复一个表,其中包含已由ETL任务加载的数据。在表的最后6列中,由于在一个字段中找到了多个分隔符,因此有些数据被放置在错误的字段中。所以我试图创建SSIS条件分割和派生列,将它们放回到正确的字段中。
我发现FR中的那些地址导致了问题。那么我怎么能:
答案 0 :(得分:0)
You can check following Update script But before running on productive, you can better copy your data as backup
I did not use a SQL split function here but instead used the SQL CharIndex function since your data has a simple structure
update AddressData
set
StreetAddress = StreetAddress + City
, City = StateProvinceCode
, StateProvinceCode = StateProvinceName
, StateProvinceName = CountryCode
, CountryCode = CountryName
, CountryName = LEFT(PostCode, CHARINDEX(',',PostCode) - 1)
, PostCode = RIGHT(PostCode, LEN(PostCode) - CHARINDEX(',',PostCode) )
where CountryName = 'FR'