question

Raj More avatar image
Raj More asked

IsDate() in SSIS

What is the best way for me to do IsDate in my SSIS package?
ssisvalidation
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Oleg avatar image
Oleg answered
I don't think that there is a built-in isDate function, but you can try any of the following: Add the script task, so you can use VB.NET functions such as DateTime.TryParse(your_value, out result) or Use the SQL query for your source data, so you can use T-SQL to safely parse values like this: select case when isdate(your_column) = 1 then cast(your_column as datetime) else null end your_column, [more_columns] from [your_source] -- etc The above should be safe, i.e declare @a varchar(10), @b varchar(10); select @a = '20100810', @b = '20099999'; select case when isdate(@a) = 1 then cast(@a as datetime) else null end a_as_datetime, case when isdate(@b) = 1 then cast(@b as datetime) else null end b_as_datetime; -- this returns: a_as_datetime b_as_datetime ----------------------- ----------------------- 2010-08-10 00:00:00.000 NULL Oleg
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.