2015-11-23 125 views

回答

1

解決方案基於Create a GUID column in SSIS

  1. 你可以把Script Component Transformation源和目的地之間。

  2. 創建新列 編輯腳本組件並轉到輸入和輸出選項卡。展開輸出0並添加一個新列。列類型應該是uniqueidentifier [DT_GUID]

  3. 腳本代碼(C#)

     
    using System; 
    using System.Data; 
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper; 
    using Microsoft.SqlServer.Dts.Runtime.Wrapper; 
    
    
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute] 
    public class ScriptMain : UserComponent 
    { 
        public override void Input0_ProcessInputRow(Input0Buffer Row) 
        { 
         // Create a Globally Unique Identifier with SSIS 
         Row.Guid = System.Guid.NewGuid(); 
        } 
    } 
    
+1

此示例假設,這樣的SSIS進口在代碼實現,爲VS的項目,如反對只使用導入嚮導GUI - 是否正確? –

+0

是的,你需要SSIS包 – lad2025