Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 11th, 2012  |  syntax: None  |  size: 0.37 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Re importing Excel file to SQL SERVER throught SSIS package
  2. MERGE RealDestinationTable AS target
  3. USING #mytable AS source
  4. ON (target.Id = source.Id)
  5. WHEN MATCHED THEN
  6.     UPDATE SET Name = source.Name
  7. WHEN NOT MATCHED THEN  
  8.     INSERT (Field1, Field2)
  9.     VALUES (source.Field1, source.Field2)
  10.     OUTPUT deleted.*, $action, inserted.*
  11.         INTO #AnyResultTempTable;