Vb.net IsDate() Question

Aug 25, 2007

Hi,

I have a package with a script task. I need to check incoming values from a file to make sure they're dates. I read the file in as one line, then create output columns. Hence, that is why I refer to the AcquistionDate field as array value 5, as this is the 6th column in the file.

In my connection manager, output columns, I have AcquisitionDate field defined as a STRING, length 10. In the flat file, dates look like this: "2007-08-23". I remove the "" with the String.Empty.

So, then I do an IsDate check.

Here is my code:


'Check date columns for date values

If IsDate(rowValues(5)) Then

Row.AcquisitionDate = rowValues(5).Replace("""", String.Empty)

Else

Row.AcquisitionDate_IsNull = True

End If


Problem is, IsDate is evaluating to FALSE. That is, execution goes to the Else portion, and sets all the AcquistionDates to NULL.

What am I doing wrong here?

Thanks

View 4 Replies


ADVERTISEMENT

Convert And Isdate

Jul 23, 2007

I have a text file I have to load an massage the data. There is a date field which is a varchar where I do a conversion. As of 7-19 the conversion to inline sql stoppped working. Look at example below

declare @dob varchar(08)
set @dob = '02291956'
select convert(datetime,Right(@dob,4) + Left(@dob,4)) as dob
select convert(datetime,Right(dob,4) + Left(dob,4)) as dob from marylanddoc

The 1st statement works, however the select statement now fails with a conversion failure. ANyone seen this pop up. Just as an FYI, I do have 20 records that were processed with a leap year 0229 date that were created by this process before 7/19

View 4 Replies View Related

ISDATE IN SQL SERVER

Aug 29, 2007

IS THERE AN EQUIVALENT FUNCTION OF ISDATE IN SQL SERVER.?

Funnyfrog

View 3 Replies View Related

T-SQL - Check For Decimal?? Like ISNULL, ISDATE, ISNUMERIC, Etc.

Apr 14, 2008

There is a MSSQL function that check the value. Like ISNULL(), ISDATE() and ISNUMERIC(). I don't see a function that check for decimal. If there isn't any then is there an user-defined function for it? I need to be able to validate the string value for decimal before it get assigned to a decimal datatype or T-SQL will run into an error.

I'm using MS-SQL 2000...

Thanks...

View 3 Replies View Related

SQL 2012 :: IsDate In SELECT To Validate / Correct Date

Dec 6, 2014

I am importing data from a legacy system. The date column is a varchar and in the destination DB it is a proper DateTime.

That said I have invalid data and need to clean / accommodate for it as I go. What I need is if the date is valid then insert it, if not then ue a default of '01/01/1900' I am doing the following and it is not working.

CASE
WHEN isDATE(RatifiedDate) = 1 THEN RatifiedDate
WHEN isDate(RatifiedDate) = 0 THEN '01/01/1900'
END as RatDate

<hr noshade size='1' width='250' color='#BBC8E5'>

View 6 Replies View Related

Trouble Converting Nvarchar(10) To Smalldate Time Where ISDATE()=1

Nov 17, 2007



I have a column which is current stored as nvarchar(10), and all of the enteries are either NULL or mm/dd/yyyy.
I am trying to convert the column to smalldatetime using CONVERT or CAST and each time I get an arithmetic overflow error message.
I also tried selecting just the enteries with ISDATE()=1 and converting those to smalldatetime, and still got an arithmetic overflow message.

(I've run ISDATE() several times on the column, and the only rows without ISDATE()=1 are those which have NULL values).

help!

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved