SSIS datetime trucation error - datetime

I'm using following expression in Derived Column Component to get hour and minute from datetime field. e.g. Get "12:13" from "2012-08-14 12:13:03.650"
LKPStartTime:
(DT_STR,5,1252)SUBSTRING((DT_STR,10,1252)(DT_DBTIME)StartTime,1,5)
However, it pops up error message of
"Derived Column" failed because truncation occurred, and the
truncation row disposition on output column "LKPStartTime" specifies
failure on truncation. "
Is there any problem of my expression? Thanks for any answers!

I think it should be 12,5 instead of 1,5

Related

Bigquery String to date invalid, safe.parse returns null #standardSQL

I am trying to convert a date value ingested from SFMC as a string. Attempts and results below:
PARSE_DATE('%m/%d/%Y', '6/22/2017’) returns “invalid date”
2.safe.PARSE_DATE('%m-%d-%Y',Timesent) returns null results
Any insight would be greatly appreciated.
I wondered if it was because the day of month had no leading zero, because according to the docs, %d means the day of the month as a decimal number (01-31).
But your first example worked OK for me in a BigQuery SQL workspace anyway as per below. Your second example has hyphens rather than slashes in the format mask, and BigQuery returns a mismatch error for me.
Are you certain about the date value which is failing for you?

Teradata Failing to Convert Date String to a Numeric value

I searched stackoverflow and on the internet but I could not find the exact answer. You can see my query below. I cannot figure out why I am getting the error message A character string failed conversion to a numeric value. I came to the conclusion it is that line of code because when I comment it out I don't get that error message but a different one. What I get instead is no more spool space which to me would make sense.
SELECT a.store_nbr AS club_number, a.visit_date, count(transaction_id)
FROM table_one
WHERE division = 1
AND a.visit_date BETWEEN '2020-01-01' AND '2020-02-01

using BDP in R for finding SETTLE_DTE (works in excel but not in R)

I need to get the settlement date of forward contracts in R.
I can do it in excel as below:
BDP("CAD1M CURNCY","SETTLE_DT","REFERENCE_DATE",TEXT(C2,"YYYYMMDD"))
(assume my specific date for which I am trying to find the settlement date on a 1 month forward contract is at cell C2)
this gives me the settlement date for the forward contract above.
So I want to do the same thing in R (I am connected to bloomberg and can get data)
I tried the followings (and many other versions):
bdp("CAD1M Curncy",c("SETTLE_DT","REFERENCE_DATE",as.Date("2018-11-15")))
but does not work.
Seems like SETTLE_DT is not recognized but I do not know how to make it recognized for bdp in R.
Here are the error messages I get
bdh("CAD1M Curncy","SETTLE_DT",REFERENCE_DATE = as.Date("20181115"),options=NULL)
Error in bdh("CAD1M Curncy", "SETTLE_DT", REFERENCE_DATE = as.Date("20181115"), : unused argument (REFERENCE_DATE = as.Date("20181115"))
bdh("CAD1M Curncy","SETTLE_DT","REFERENCE_DATE" = as.Date("20181115"),options=NULL)
Error in bdh("CAD1M Curncy", "SETTLE_DT", REFERENCE_DATE = as.Date("20181115"), : unused argument (REFERENCE_DATE = as.Date("20181115"))
bdh("CAD1M Curncy","SETTLE_DT","REFERENCE_DATE = as.Date("20181115")",options=NULL)
Error: unexpected numeric constant in "bdh("CAD1M Curncy","SETTLE_DT","REFERENCE_DATE = as.Date("20181115"
bdp("CAD1M Curncy","SETTLE_DT","REFERENCE_DATE = as.Date("20181115")",options=NULL)
Error: unexpected numeric constant in "bdp("CAD1M Curncy","SETTLE_DT","REFERENCE_DATE = as.Date("20181115"
bdp("CAD1M Curncy","SETTLE_DT",as.Date("20181115"),options=NULL)
Error in charToDate(x) : character string is not in a standard unambiguous format
bdp("CAD1M Curncy","SETTLE_DT",as.Date("2018-11-15"),options=NULL)
Error in bdp_Impl(con, securities, fields, options, overrides, verbose, : Request overrides must be named.
bdp("CAD1M Curncy","SETTLE_DT","REFERENCE_DATe",as.Date("2018-11-15"),options=NULL)
Error in bdp_Impl(con, securities, fields, options, overrides, verbose, : Request overrides must be named.
bdp("CAD1M Curncy","SETTLE_DT",c("REFERENCE_DATe"=as.Date("2018-11-15")),options=NULL) SETTLE_DT CAD1M Curncy 2018-12-31
also if I change the date above to "20181115" instead, it will give me
Error in charToDate(x) : character string is not in a standard unambiguous format
also with so the last one is the only one which gives me some answer but it is basically only giving me the settlement date of the last forward contract (for today) and does not take into account my reference date. In excel the following command works and gives me the right output: =BDP("CAD1M Curncy","SETTLE_DT","REFERENCE_DATE","20181115") output: 2018/12/17
Also tried:
bdp("CAD1M Curncy","SETTLE_DT",c("REFERENCE_DATe",as.Date("2018-11-15")),options=NULL)
Error in bdp_Impl(con, securities, fields, options, overrides, verbose, : Request overrides must be named.
Any ideas?
Thank you guys really appreciate it
bdp("CAD1M Curncy", "SETTLE_DT", overrides = c("REFERENCE_DATE"="20181115"))
solved the problem.
Thanks Assylias.
You are using different date format between Excel and R, which is a possible cause. I'd suggest to use ...as.Date("20181115") in R, as well. Also, it would be helpful to share the entire error message.

Extracting value from HTML table and applying assertion

I am trying to extract a value which is in integer form i.e 60.
I have a code that is going through each row and each column and then using getText() method retrieve the value from column.
When applying testNG assertEqual,the value is not matched as the value found is "[60 ]" instead of "[60]".
Output of trace:
The Text is 60
Exception in thread "main" java.lang.AssertionError: expected [60] but found [60 ]
at org.testng.Assert.fail(Assert.java:94)
at org.testng.Assert.failNotEquals(Assert.java:494)
at org.testng.Assert.assertEquals(Assert.java:123)
at org.testng.Assert.assertEquals(Assert.java:165)
at rough.Test.main(Test.java:83)
Can someone help me finding how I can fix the assertion?
do you in fact have a trailing space in the table?
this is an issue that is good to find in testing
perhaps you should trim the result of getText()
Maybe because your code looks something like this<td>60 </td>
You are getting that extra space. You can try something like this.
String s = node.getText().trim();
assertEqual(s, "60");

XQuery "The content of elements must consist of well-formed character data or markup." error on where clause

The exact error message I am getting through oXygen editor is "The content of elements must consist of well-formed character data or markup."
The part of the query that is causing the error is the following
for $top at $ind in $probSort
where $ind <= 20
return $top
According to the error message the exact text causing the error is "= 20", when I remove the "where" line the query executes perfectly and outputs the results with no error.
What exactly is going wrong because I am at a loss after two days of searching?
Thanks in advance.
--edit
First of all, i have fixed the code by changing
collection(resolve-uri("../folder_name"))
to
collection(resolve-uri("./?select=*.xml"))
which allows me to use the symbol "<=".
I wonder what makes the difference between the two version of collection(). Could somebody elaborate?
Thanks a lot.
Did you try
where $ind le 20
instead of
where $ind <= 20
?

Resources