【问题标题】:Copy data from Postgres to SQLServer using SSIS with date parameters使用带有日期参数的 SSIS 将数据从 Postgres 复制到 SQLServer
【发布时间】:2019-12-29 23:46:20
【问题描述】:

我想使用 SSIS 将数据从 postgres DB 复制到 SQL Server。我已经使用数据流并成功了。但是这次我想在查询中使用参数日期。

例如:

SELECT * 
FROM dw_sales 
WHERE transaction_date >= current_date - 7

我想在 SSIS 中使用参数@fromdate 替换 current_date - 7,所以查询将是

SELECT * 
FROM dw_sales 
WHERE transaction_date >= current_date - @fromdate

如果我在 SQL Server 中使用存储过程,我知道该怎么做,但是当我从 Postgres 复制数据时,我不知道怎么做。

你们能帮帮我吗?

【问题讨论】:

    标签: sql sql-server postgresql ssis etl


    【解决方案1】:

    在 OLE DB Source 中,使用 SQL Command 选项并使用? 标记添加参数:

    SELECT * FROM dw_sales WHERE transaction_date >= current_date - ?
    

    然后点击Parameters按钮将此参数映射到SSIS变量:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-09
      • 2018-09-02
      • 1970-01-01
      • 2019-12-02
      • 1970-01-01
      • 1970-01-01
      • 2017-08-26
      相关资源
      最近更新 更多