开发者

SSIS 2008 - How to validate dates

开发者 https://www.devze.com 2023-03-03 20:53 出处:网络
I want to validate a date in SSIS. If I was using T-SQL, I would use I开发者_如何学JAVASDATE. What is the SSIS equivalent?SSIS does not have a built-in date validation method.Some people have writte

I want to validate a date in SSIS.

If I was using T-SQL, I would use I开发者_如何学JAVASDATE.

What is the SSIS equivalent?


SSIS does not have a built-in date validation method. Some people have written work-arounds but they tend to have problems with all of the special cases. Your best bet would be to script something or, if possible, do the validation inside of SQL before you get the data (I know that probably isn't possible since you are asking the question but just a thought). You could even create a stored procedure that accepted a "date" parameter and validated it in SQL. That way SSIS could use it without creating a complicated script.


Use following Regex script to validate date in script component in ssis.

This below scripts validate date following format (mm/dd/yyyy)

^([1][012]|[0]?[1-9])[/]([3][01]|[12]\d|[0]?[1-9])[/]([1-8][0-9][0-9][0-9]|9000)$

(mm/dd/yyyy hh:mm:ss)

^([1][012]|[0]?[1-9])[/]([3][01]|[12]\d|[0]?[1-9])[/]([1-8][0-9][0-9][0-9]|9000)\s([01]?[0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9])$

both scripts date allowed (01/01/1000 to 12/31/9000)

0

精彩评论

暂无评论...
验证码 换一张
取 消