Convert yymmdd to datetime using ssis derived column - ssis

Below are the strings representing date of birth (yymmdd). I want to convert it into datetime format and load into a database using ssis. How can I do it? In my derived column I have (DT_DATE)(SUBSTRING([Drv DOB],1,2) + "-" + SUBSTRING([Drv DOB],3,2) + "-" + SUBSTRING([Drv DOB],5,2)), but it's not working.
I GET THESE ERRORS:
[Derived Column [2]] Error: An error occurred while attempting to perform a type cast.
[Derived Column [2]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived Column" failed because error code 0xC0049064 occurred, and the error row disposition on "Derived Column.Inputs[Derived Column Input].Columns[Drv DOB]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
•470324
•470324
•470209
•101
•0

YEAR have 4 digits not 2, so it would be:
(DT_DATE)("20" + SUBSTRING([Drv DOB],1,2) + "-" +
SUBSTRING([Drv DOB],3,2) + "-" +
SUBSTRING([Drv DOB],5,2))

This works for me! Thanks everyone
([Drv DOB] == "0") || ([Drv DOB] == "101") ? NULL(DT_DBTIMESTAMP) : (DT_DBTIMESTAMP)(SUBSTRING([Drv DOB],1,2) + "-" + SUBSTRING([Drv DOB],3,2) + "-" + SUBSTRING([Drv DOB],5,2))

Related

Warning: (1366, "Incorrect string value: '\\xB4\\xEB\\xC7\\xD1\\xB9\\xCE...' for column 'VARIABLE_VALUE' at row 1") result = self._query(query)

This error occurs whenever I try to insert below table in mysql schema.
I used code like this
self.collect.allday_list.to_sql(name=code_name, con=self.collect.engine_allday, if_exists='append')
and self.collect.egine_allday is
self.engine_allday = create_engine("mysql+mysqldb://" + info.db_id + ":" + info.db_passwd + "#"
+ info.db_ip + ":" + info.db_port + "/allday_list", encoding = 'utf-8')
and Warning: (1366, "Incorrect string value: '\xB4\xEB\xC7\xD1\xB9\xCE...' for column 'VARIABLE_VALUE' at row 1") result = self._query(query)
it doesn't have any emoji or special letter, but error is occurred
how do i get this table into schema in mysql?
Somewhere in the data you are trying to insert there is text encoded in euc-kr:
>>> bytes.decode(b'\xB4\xEB\xC7\xD1\xB9\xCE', encoding='euc-kr')
'대한민'
These bytes do not represent valid text in utf-8. You can try changing the database connection encoding to euc-kr, or converting the data from euc-kr to utf-8 when you read it.
On the other hand, the screenshot of the data has only numbers, no text. This suggests you may be trying to load the wrong file or that perhaps there is a portion of the file that you didn't want to insert in the database.

Derived column expression give truncation error

I have the following expression:
IsNull is column Name-- all the columns are numeric
ExpectedPremium:
([Isnull] < ExpectedMinPremium) ? ("Min" + ((DT_WSTR,10)(exp_pct_min * 100)) + "% = " + (DT_WSTR,10)ExpectedMinPremium) : ([Isnull] > ExpectedMaxPremium) ? ("Max" + ((DT_WSTR,10)(exp_pct_max * 100)) + "% = " + (DT_WSTR,10)ExpectedMaxPremium) : ""
The result of the column should look like : MAX 60% = 389727.600
I am not getting an error while creating the derived column but once I run the package I get the following message:
The "Derived Column" failed because truncation occurred, and the truncation row disposition on "Derived Column.Outputs[Derived Column Output].Columns[ExpectedPremium]" specifies failure on truncation.
A truncation error occurred on the specified object of the specified component.
It writes some rows (less than the input), I increased the destination length and it didn't work.
How to fix this expression?

to type "System.Int32"Error:"Input string was not in a correct format

I Run the this power shell script
"$InstallPh\Database\bin\mysql.exe" -'uroot' -'e''select status from zibcatalog.zibmonitor where backupset="$BACKUPSET" AND operation="ZIB_BACKUP";' > 'c:\\auto\\firstbackup-result.txt'
Powershell throws this error message:
Cannot convert value "\Database\bin\mysql.exe" to type "System.Int32". Error: "Input string was not in a correct format."
At line:1 char:2
+ "$InstallPh\Database\bin\mysql.exe" -'uroot' -'e''select status from zibcatalog ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastFromStringToInteger
Your problems the way your trying to execute and pass the parameters to MySQL.exe. Try using the & operator to execute the exe file.
& "$InstallPh\Database\bin\mysql.exe" "-uroot -e'select status from zibcatalog.zibmonitor where backupset=`"$BACKUPSET`" AND operation=`"ZIB_BACKUP`";'" > 'c:\auto\firstbackup-result.txt'

SSIS expression to convert string to date

Using SQL Server 2008, Visual Studio 2008.
Trying to convert the data from a string column into a derived Date column.
The string can be in two formats, either : "dd/mm/yy" (where century 20 can be assumed), or "dd/mm/yyyy" . e.g. "02/05/12", "23/12/02", "13/08/2012".
So I tried an expression like this for a Derived column :
DateReceived == "" ? NULL(DT_DATE) : (DT_DATE)((LEN(RTRIM(DT_DATE)) == 10 ? SUBSTRING(DateReceived,7,4) : ("20" + SUBSTRING(DateReceived,7,2))) + "-" + SUBSTRING(DateReceived,4,2) + "-" + SUBSTRING(DateReceived,1,2))
but Visual Studio gives error :
"The expression was not valid, or there is an out-of-memory error".
It accepts a simpler expression like :
DateReceived == "" ? NULL(DT_DATE) : (DT_DATE)("20" + SUBSTRING(DateReceived,7,2) + "-" + SUBSTRING(DateReceived,4,2) + "-" + SUBSTRING(DateReceived,1,2))
but this expression will only work for "dd/mm/yy" format.
What am I doing wrong ? Thanks.
Never mind, the error was due to a typo. (Was calling RTRIM on the column type, not column name).
The following works :
DateReceived == "" ? NULL(DT_DATE) : (DT_DATE)((LEN(RTRIM(DateReceived)) == 10 ? SUBSTRING(DateReceived,7,4) : ("20" + SUBSTRING(DateReceived,7,2))) + "-" + SUBSTRING(DateReceived,4,2) + "-" + SUBSTRING(DateReceived,1,2))

AS3 Warning message excess bytes

When I publish my flash files, I get this message:
WARNING: excess bytes: -616, Tag: DefineFont3, Index: 5
WARNING: excess bytes: 2, Tag: DefineFont3, Index: 36
What are these warning? Anything related to these warning?
Yesterday is still fine, but today I get this.
Maybe one of your libraries are using the SWFTimeline. It's source code contains the very same warning.
The following code snippet is from the SWFTimeline.as file, starting at line 84.
// Adjust position (just in case the parser under- or overflows)
if(data.position != pos + tagHeader.tagLength) {
trace("WARNING: excess bytes: " +
(data.position - (pos + tagHeader.tagLength)) + ", " +
"Tag: " + tag.name + ", " +
"Index: " + (tags.length - 1)
);
data.position = pos + tagHeader.tagLength;
}
It seens to be caused by malformed tags or file corruptions, maybe other reasons too.