Skip to content

Instantly share code, notes, and snippets.

SET @ver = CHANGE_TRACKING_CURRENT_VERSION() 
SELECT *
FROM CHANGETABLE(CHANGES dbo.Emp, @ver) 
INSERT dbo.Emp VALUES ('Joey' ,NULL ,'Tribbiani')
INSERT dbo.Emp VALUES ('Chandler' ,NULL, 'Bing')
INSERT dbo.Emp VALUES ('Ross',NULL,'Geller')
INSERT dbo.Emp VALUES ('Monica',NULL,'Geller')
INSERT dbo.Emp VALUES ('Rachel',NULL,'Green')
INSERT dbo.Emp VALUES ('Phoebe',NULL,'Buffay') 
SELECT CHANGE_TRACKING_CURRENT_VERSION() 
ALTER TABLE [dbo].[Emp]
ENABLE change_tracking WITH (track_columns_updated = ON)
CREATE TABLE Emp
(
ID         INT PRIMARY KEY IDENTITY(1, 1),
FirstName  VARCHAR(100),
MiddleName VARCHAR(100),
LastName   VARCHAR(100)
public override void CreateNewOutputRows()
{
// All I need to do in this script component is to cast the object variable to a DataTable
DataTable dt = (DataTable)Variables.vResults;
// The DataTable is now ready to use! No more recordset quirks.
foreach (DataRow dr in dt.Rows)
{
/*
public void Main()
{
// Set up the DataAdapter to extract the data, and the DataTable object to capture those results.
// This will write the contents of the Recordset to a new DataTable object.
OleDbDataAdapter da = new OleDbDataAdapter(); // Create the connector
DataTable dt = new DataTable(); // Create the output DataTable
da.Fill(dt, Dts.Variables["vResults"].Value); // Load the DataTable
USE SSISDB;
GO
DECLARE @execution_id BIGINT;
EXEC [SSISDB].[catalog].[create_execution]
@package_name = N'DEMO SFTP List.dtsx'
, @execution_id = @execution_id OUTPUT
, @folder_name = N'SSIS Parameters'
, @project_name = N'SSIS Parameters'
, @use32bitruntime = False
BEGIN TRAN
INSERT #idtest
VALUES ('Hop')
, ('Skip')
, ('Jump')
ROLLBACK TRAN