Data is not a numeric-literal (IES 10901) (WIS 10901) - business-objects

Seems like another in a row of BusinessObject bugs. Here is the background: Set of objects was selected and a filter was set on those objects. Now, when I run that query in Information Design Tool, I GET exactly the rows I am expecting. Then I publish the universe, and run the same query with WEBI, and then I get this message:
"Data is not a numeric-literal (IES 10901) (WIS 10901)"
Please somebody give me a reasonable "BO-Style" explanation why the same query works in IDT and is not working in WEBI.
Generated SQL statement:
SELECT
D_ATA_MV_FinanceTreasury.VWD_Party_A.Party_KEY,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Location_KEY,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Name_NAM,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Given_Name_NAM,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Short_Name_NAM,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Date_Of_Birth_DAT,
D_ATA_MV_FinanceTreasury.VWD_Nationality_A.Nation_German_NAM,
D_ATA_MV_FinanceTreasury.VWD_Segment_Value_A.Description_TXT,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Company_Reg_Number_TXT,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Vat_Code_TXT,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Employees_NUM,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Customer_From_DAT,
D_ATA_MV_FinanceTreasury.VWD_Party_A.Last_Edit_DAT,
D_ATA_MV_FinanceTreasury.VWD_Party_A.ANZ_BEN_pro_Party,
sum(D_ATA_MV_FinanceTreasury.VWF_Party_Umsatz_A.Umsatz_Gesamt)
FROM
D_ATA_MV_FinanceTreasury.VWD_Nationality_A RIGHT OUTER JOIN D_ATA_MV_FinanceTreasury.VWD_Party_A ON (D_ATA_MV_FinanceTreasury.VWD_Nationality_A.Nation_CD=D_ATA_MV_FinanceTreasury.VWD_Party_A.Nationality_CD)
LEFT OUTER JOIN D_ATA_MV_FinanceTreasury.VWD_Segment_Value_A ON (D_ATA_MV_FinanceTreasury.VWD_Segment_Value_A.Segment_Value_KEY=D_ATA_MV_FinanceTreasury.VWD_Party_A.Segment_Value_KEY)
INNER JOIN D_ATA_MV_FinanceTreasury.VWF_Party_Umsatz_A ON (D_ATA_MV_FinanceTreasury.VWD_Party_A.Party_KEY=D_ATA_MV_FinanceTreasury.VWF_Party_Umsatz_A.Party_KEY)
GROUP BY
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14

Looking at the Error Messages Explained guide, it states:
Database error: {error_db}. (IES 10901)
Cause: The database returned the error given in the message.
In other words, the SQL statement that was generated and sent to the database resulted in a database error. One possible explanation could be that there is a implicit conversion (i.e. from alphanumeric to numeric) which is causing the error message.
As for the difference in IDT and Webi running the same query: keep in mind that IDT will (by default) only retrieve the first 200 rows, not the complete dataset. If the issue was caused by an implicit conversion, this would mean that the offending record was not a part of that sample set retrieved by IDT, thus not resulting in an error.

Related

This query used to work fine, now it fails. Why?

I am not super strong at SQL, so I apologize ahead of time. I have the following query that used to work without issue:
select A.arcNumber,
A.arcName,
A.arcContact,
B.easEmailAddress,
E.asrcode,
A.arcARSalesRepID,
A.arcOpenOrderAmt,
C.lkpCaption AS EmailLookup,
D.lkpCaption AS CustomerType
from orman.dbo.tblARCustomer A
INNER JOIN orman.dbo.tblEmailAddress B
ON A.arcID = B.easEntityId
AND B.easEntityType = 'C'
INNER JOIN orman.dbo.tblLookup C
On C.lkpID = B.easEmailTypeLookupID
AND C.lkpCaption = 'GENERAL'
INNER JOIN orman.dbo.tblLookup D
On A.arcCustomerSourceLookupID = D.lkpID
INNER JOIN orman.dbo.tblARSalesREp E
ON A.arcARSalesRepID = E.asrCode
where A.arcIsActive = 1
Now I am receiving the following error when trying to execute:
Started executing query at Line 1
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value '.' to data type int.
Total execution time: 00:00:00.011
What happened that caused it to throw this error and how can I resolve this? Thank you ahead of time for any responses.
The reason for the error Conversion failed when converting the varchar value '.' to data type int. to occur is that there is an attempt made to convert a character that is not numeric into int type. Try using the following steps to overcome this error.
Inspect the data in your tables, there might be a column which is of varchar type and consists of incorrect numeric values. So, the conversion fails, and it gives you an error
When joining on the condition, try casting the column to int using TRY_CAST function. This function converts the current datatype to required datatype. If the conversion is unsuccessful for any reason (as in your case), the function returns NULL.
This should help in avoiding the error. Please refer to this Microsoft Q&A which addresses the similar issue. Also refer to this following link to understand about TRY_CAST method.
TRY_CAST (Transact-SQL) - SQL Server | Microsoft Docs

Insert NA values in Mysql table RMySQL

I am trying to insert a data frame row in a mysql table, but I have NA values in character and numeric columns. I'm getting this error: Error in .local(conn, statement, ...) :
could not run statement: Unknown column 'NA' in 'field list'
This is my query:
sql <- sprintf("insert into payment (amount,payment_type,date,customer_total,base_price, p2c_total, partner_total, pay_online, pay_at_lot,tax,first_name_on_card,last_name_on_card,address)
values (%f, %d, '%s',%f,%f,%f,%f,%f,%f,%f,'%s','%s','%s');",
payments[i,]$amount,payments[i,]$payment_type,payments[i,]$date, payments[i,]$customer_total,
payments[i,]$base_price, payments[i,]$p2c_total, payments[i,]$partner_total,
payments[i,]$pay_online,payments[i,]$pay_at_lot,payments[i,]$tax,
payments[i,]$first_name_on_card, payments[i,]$last_name_on_card, payments[i,]$address)
rs <- dbSendQuery(db, sql[i])
dbClearResult(rs)
This is the sql code:
insert into reservation (reservation_number, driver_name, number_passengers, checkin_datetime, checkout_datetime, days, reservation_date, reservation_email,id_reservation_status, id_payment, id_ship, id_facility, id_user) values ('j990j','CB', 4, '2020-01-12 10:00:00', '2020-01-19 10:30:00', 8, 'NA', 'cb#gmail.com',NA, 1, 2, 547, 6);
And this is the mysql error:
#1054 - La columna 'NA' en field list es desconocida
MySQL version: 8.0.27
R version: 4.03
RMySQL package: 0.10.22
Three ways to look at this:
Don't sprintf/paste data into a query string. In addition to security concerns about malicious SQL injection (e.g., XKCD's Exploits of a Mom aka "Little Bobby Tables"), it is also a concern for malformed strings or Unicode-vs-ANSI mistakes, even if it's one data analyst running the query.
Conveniently, there's a function that takes care of inserting data from a data.frame into the table in a safer way: dbAppendTable. You might be able to do just
dbAppendTable(db, "payment", payments[i,])
if all of the columns need to be inserted, otherwise something more verbose is necessary:
dbAppendTable(db, "payment", payments[i,c("amount", "payment_type", "date", "customer_total", "base_price", "p2c_total", "partner_total", "pay_online", "pay_at_lot", "tax", "first_name_on_card", "last_name_on_card", "address")])
If you're planning on doing this for more than 1 row, then dbAppendTable can take multiple rows with no issue.
If you really want to do one row at a time with your own insert statement, then I strongly urge you to use parameterized queries, perhaps something like:
qry <- "insert into payment (amount,payment_type,date,customer_total,base_price, p2c_total, partner_total, pay_online, pay_at_lot,tax,first_name_on_card,last_name_on_card,address)
values (?, ?, ?,?,?,?,?,?,?,?,?,?,?);"
dbExecute(db, qry, params = payments[i, c("amount", "payment_type", ...)])
(That reminds me ... dbExecute is a nice wrapper that does dbSendStatement always followed by dbClearResult. There's also dbGetQuery which is really dbSendQuery always followed by dbClearResult, returning the data. You aren't returning rows from the table, so the first is preferred anyway.)
NOTE: this feature requires an up-to-date driver for accessing the database. If you're using RMySQL then there is a problem: that package has not seen substantive updates in years (as of now) and does not support parameterized queries. I believe the RMariaDB package is both fully compatible with MySQL and it supports parameterized queries.
If you must really do this manually (and really, I discourage it strongly, too many times I thought I could work around the risks, only to be bitten each time), then R's NA translates into null (no quotes!). To do this, you need to conditionally add quotes. Something like:
ifelse(is.na(payments[i,]$date), "null", sQuote(payments[i,]$date))
for each string-like field in your query, and make sure to change '%s' to %s in your format. There are almost certainly better ways to automate this so that you aren't typing a dozen or more ifelses, but in my opinion it really is not worth the pain of doing that.
(If you're relying on different semantics of sprintf("%s", ..) versus the implicit string-ification with sQuote, then you may need even more elbow-grease there.)
wrap your NA to 'NA'
insert into reservation (reservation_number, driver_name, number_passengers, checkin_datetime, checkout_datetime, days, reservation_date, reservation_email,id_reservation_status, id_payment, id_ship, id_facility, id_user) values ('j990j','CB', 4, '2020-01-12 10:00:00', '2020-01-19 10:30:00', 8, 'NA', 'cb#gmail.com','NA', 1, 2, 547, 6);

Using FORMAT_DATETIME with Tableau and BigQuery

I'm connecting to BigQuery to get information for a Sankey Diagram in Tableau. However, I am getting this information from 2 different datasets: "audience exited" and "audience entered". I am using the User IDs and the original timestamps to join the 2 datasets. However, the timestamps are in a datetime format and those times do not coincide with each other across datasets given that a user can exit an audience at 2 a.m and only enter a new audience at 4 a.m. Hence, I am using "FORMAT_DATETIME" to remove the time on the original timestamps i.e: from "2021/07/07 23:32" to "2021-Jul-7" as shown in the SQL code below:
SELECT `audience_exited`.`active_customers` AS `active_customers`,
`audience_exited`.`audience_key` AS `audience_key`,
FORMAT_DATETIME("%Y-%b-%d",auience_exited`.`original_timestamp`) AS `original_timestamp`,
`audience_exited`.`received_at` AS `received_at`,
`audience_exited`.`user_id` AS `user_id`,
`audience_entered`.`active_customers` AS `active_customers__audience_entered_`,
`audience_entered`.`audience_key` AS `audience_key__audience_entered_`,
FORMAT_DATETIME("%Y-%b-%d",`audience_entered`.`original_timestamp`) AS `original_timestamp__audience_entered_`,
`audience_entered`.`received_at` AS `received_at__audience_entered_`,
`audience_entered`.`user_id` AS `user_id__audience_entered_`,
"audience_key" AS Vizside
FROM `dial-a-delivery-ke.personas_personas_prod`.`audience_exited` `audience_exited`
FULL JOIN `dial-a-delivery-ke.personas_personas_prod`.`audience_entered` `audience_entered` ON ((`audience_exited`.`user_id` = `audience_entered`.`user_id`) AND (`audience_exited`.`original_timestamp` = `audience_entered`.`original_timestamp`))
I get the following error when I run it in Tableau:
An error occurred while communicating with the data source
Error Code: 015CFBE6 The Google BigQuery service was unable to compile
the query. Syntax error: Expected ")" but got identifier . at [5:46]
And I do not know what to make of this since everything seems fine to me. Please can you assist with this error?
TRY BELOW CODE
SELECT `audience_exited`.`active_customers` AS `active_customers`,
`audience_exited`.`audience_key` AS `audience_key`,
FORMAT_DATETIME("%Y-%b-%d",`auience_exited`.`original_timestamp`) AS `original_timestamp`,
`audience_exited`.`received_at` AS `received_at`,
`audience_exited`.`user_id` AS `user_id`,
`audience_entered`.`active_customers` AS `active_customers__audience_entered_`,
`audience_entered`.`audience_key` AS `audience_key__audience_entered_`,
FORMAT_DATETIME("%Y-%b-%d",`audience_entered`.`original_timestamp`) AS `original_timestamp__audience_entered_`,
`audience_entered`.`received_at` AS `received_at__audience_entered_`,
`audience_entered`.`user_id` AS `user_id__audience_entered_`,
"audience_key" AS Vizside
FROM `dial-a-delivery-ke.personas_personas_prod`.`audience_exited` `audience_exited`
FULL JOIN `dial-a-delivery-ke.personas_personas_prod`.`audience_entered` `audience_entered` ON ((`audience_exited`.`user_id` = `audience_entered`.`user_id`) AND (`audience_exited`.`original_timestamp` = `audience_entered`.`original_timestamp`))

Progress SQL error in ssis package: buffer too small for generated record

I have an ssis package which uses SQL command to get data from Progress database. Every time I execute the query, it throws this specific error:
ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Internal error -1 (buffer too small for generated record) in SQL from subsystem RECORD SERVICES function recPutLONG called from sts_srtt_t:::add_row on (ttbl# 4, len/maxlen/reqlen = 33/32/33) for . Save log for Progress technical support.
I am running the following query:
Select max(ROWID) as maxRowID from TableA
GROUP BY ColumnA,ColumnB,ColumnC,ColumnD
I've had the same error.
After change startup-parameter -SQLTempStorePageSize and -SQLTempStoreBuff to 24 and 3000 respectively the problem was solved.
I think, for you the values must be changed to 40 and 20000.
You can find more information here. The name of the parameter in that article was a bit different than in my Database, it depends on the Progress-version witch is used.

SQL Openquery - Object has no columns

I have a dynamically Stored Procedure, which creates an mdx statement for an OpenQuery. So it can happen that the objects from the mdx statement are empty. In this case I want back an empty string.
Generally, the query works except when I choose a date that is from the future in which case the SQL Server gives me this error:
"The OLE DB provider "XYZ" for linked server "XYZ" indicates that
either the object has no columns or the current user does not have
permissions on that object."
select
t.*
from OPENQUERY([SomeServer_OLAP],''
SELECT
non empty{[Measures].[FactWorkItemHistory Microsoft_VSTS_Scheduling_OriginalEstimate],
[Measures].[FactWorkItemHistory Microsoft_VSTS_Scheduling_CompletedWork],
[Measures].[Microsoft_VSTS_Scheduling_RemainingWork]} ON COLUMNS
, NON EMPTY { ([Work Item].[Iteration Path].[Iteration Path].ALLMEMBERS
* [Work Item].[System_AssignedTo].[System_AssignedTo].ALLMEMBERS)} on ROWS
FROM [Team System]
WHERE '+#Month+'
'') t'
So, entering the date parameter for December (the month of writing this post) works fine, but entering January of 2018 (next month) and all the other following months returns the error. Any help is appreciated.
Removing "non empty" from the query fixed my issue. There doesn't seems to be any immediate observable drawbacks to this.