SQL JOB + SSIS包+传递日期作为参数 [英] SQL JOB +SSIS package + pass date as parameter

查看:72
本文介绍了SQL JOB + SSIS包+传递日期作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将SSIS包作为部署到文件系统的包部署模型。我们想将包存储在sql server数据库中。因此,我们的dba将它们转换为项目部署模型并将它们存储在SQL Server 2016中。我们使用SQL Job执行它们。
为此,我们必须将一堆变量作为包中的参数。其中一个参数是包中的datetime类型。当我们尝试从sql job传递值到该参数GETDATE()时,我得到错误:

We had SSIS packages as package deployment model deployed to file system. We wanted to store the packages in sql server database. So, our dba converted them to project deployment model and stored them in SQL Server 2016. We are executing them using SQL Job. For this to work, we had to make bunch of variables as parameters in packages. One of the parameter is of datetime type in package. When we try to pass value to that parameter GETDATE() from sql job, I get error as:

输入值的数据类型与'DateTime的数据类型不兼容'。

The data type of the input value is not compatible with the data type of the 'DateTime'.

我在作业步骤窗口中尝试设置'运行方式' - SQL Server代理服务帐户  - 没有运行

I tried in job-steps window, setting 'Run as' - SQL Server Agent Service Account  - didn't run

尝试将该选项设置为"TSQL"和

Tried setting that option to 'TSQL' and

我甚至尝试将日期转换为varchar。没有任何作用。

I even tried converting date to varchar. Nothing works.

我无法将package参数作为日期时间的varchar,因为它在很多地方使用。

I can't make package parameter as varchar for datetime because it is used in many places.

任何建议。

谢谢

推荐答案

嗨Spunny,

Hi Spunny,

请尝试将输入日期参数​​更改为以下格式:

Please try to change your input date parameter into the following format:

yyyy-MM-dd ,例如:2019-05-25

yyyy-MM-dd, for example: 2019-05-25


这篇关于SQL JOB + SSIS包+传递日期作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆