SSIS 2008 - 在变量中获取当前日期 [英] SSIS 2008 - Get Current Date in Variables

查看:34
本文介绍了SSIS 2008 - 在变量中获取当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SSIS 2012 中,我可以使用带有变量表达式的 GETDATE() 函数获取当前日期.

In SSIS 2012 I can get current date using GETDATE() function with expression in variables.

虽然,在 SSIS 2008 中不存在表达式字段.

Though, in SSIS 2008 expression fields does not exist.

问题:如何使用 SSIS 2008 中的变量动态获取当前日期?

Question: How can I get current date dynamically with variables in SSIS 2008?

推荐答案

帮助我了解 2008 年的 SSIS 表达式语言中如何不存在 GETDATE().

Help me understand how GETDATE() doesn't exist in the SSIS Expression language for 2008.

也就是说,我发现使用系统变量 @[System::StartTime]GET_DATE() 更可取.StartTime 为包的持续时间提供一致的时间点.每当包开始执行时总是如此.将其与现在的 GETDATE() 值进行对比.现在.现在.每次检查该值时,它都会发生变化.当您构建具有第二精度的文件名时,这可能会给您带来麻烦.或者,如果您想对在一次运行中插入的所有数据进行分组.您将在这些值中出现漂移,因此您必须使用范围查询来识别运行 X 中的所有数据.或者您可以使用 StartTime,它在包开始运行时更新,但在持续时间内保持不变.

That said, I find that using the system variable @[System::StartTime] preferable to GET_DATE(). StartTime provides a consistent point in time for the duration of a package. It will always be whenever the package begins execution. Contrast that with the value of GETDATE() which is right now. Now. NOW. Every time you inspect that value, it's subject to change. This can cause trouble you when you build a file name with second precision. Or if you want to group all the data that was inserted in a single run. You'll have drift in those values so you must use range queries to identify all the data in run X. Or you can use StartTime which is updated when the package begins to run but remains constant for the duration.

这篇关于SSIS 2008 - 在变量中获取当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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