MarkLogic ODBC for Tableau - Date casting error - odbc

I have a MarkLogic ODBC server for a tableau connection. I have created the view and is already accessible. However, I am having problems manipulating Date elements in Tableau. I've encountered the following error:
An error occurred while communicating with the Other Databases (ODBC) data source 'database (new.database) (__MarkLogic)'.
Bad Connection: Tableau could not connect to the data source.
ERROR: XDMP-CAST: (err:FORG0001) Invalid cast: () cast as xs:date;
Error while executing the query
SELECT SUM("database"."amount") AS "sum_amount_ok",
SUM("database"."offered") AS "sum_offered_ok",
"database"."type" AS "type"
FROM "new"."database" "database"
WHERE (CAST({fn TRUNCATE(EXTRACT(YEAR FROM CAST("database"."date_of_permit" AS DATE)),0)} AS INTEGER) = 2014)
GROUP BY 3
Running this query (removing the {fn} tag) in qconsole results in the same casting error. How do I resolve this?
Thanks!
Update:
As grtjn commented, there is a null entry in my data that is causing this casting error.

Related

Snowflake ODBC driver (64 bit) error while setting up DSN

I am trying to set up Data Source Name for Snowflake database connection using ‘ODBC Data Sources (64 bit)’. I have downloaded and installed Snowflake ODBC driver. I do see ‘SnowflakeDSII Driver’ in the ODBC driver list. When I try to setup Data Source Name, I am running into the following error …
[SIMBA][DSI] An error occurred while attempting to retrieve the error message for key 'DSN Error' and Component ID 102:
Invalid source component ID: 102
Appreciate your help in resolving this issue.
Thanks.
Venkat.
The issue is now resolved.
After specifying value for 'Data Source', it allowed me to create the DSN.
Thanks.
Venkat.

How to read an escaped table in SQL Server from R DBI?

I was able to use DBI::dbWriteTable to write a table with a non-standard name [name#place:funny/pages], but I am unable to read it back in with DBI::dbReadTable.
When I try with:
dbReadTable(con, '[name#place:funny/pages]')
I see the error:
Error: nanodbc/nanodbc.cpp:1655: 00000: [Microsoft][ODBC Driver 17 for SQL Server][SQL Serv [Microsoft][ODBC Driver 17 for SQL Server][S L Serv 'SELECT * FROM "[name#place:funny/pages]"'
sessionInfo tells me I am using odbc_1.3.2 and DBI_1.1.1.
What am I doing wrong? Is there a way around the problem? I need to use that naming scheme to maintain compatibility with established processes.
I am able to read this table without issue from SQL with:
select * from [name#place:funny/pages]
The answer is to not include brackets at all.

Greatest function in Teradata is throwing error with more than two arguments

When I am executing the below code select greatest(13,6,20,30) in Teradata , it is throwing the below error:
ERROR [HY000] [Teradata][ODBC Teradata Driver][Teradata Database] Function 'greatest' called with an invalid number or type of parameters
SELECT Command Failed.
Although it is working with two arguments. As per documentation of version 16.* this function can accept till 10 arguments. I am working with Teradata version 16.2. Is there anything wrong with the SQL statement?

Execute SQL with "like" statement in R Language

I am trying to execute a SQL Query through R to get the data from Access DB
Normal SQL statement works fine, but when it comes to like statement its throwing error
Below is code :
library(RODBC);
channel = odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:/Users/ADMIN/Documents/R.accdb")
test = sqlQuery(channel ,paste('SELECT R.ID, R.Template, R.WEDate FROM R WHERE R.Template Like "*slow*"'))
Error:
[1] "07002 -3010 [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2."
[2] "[RODBC] ERROR: Could not SQLExecDirect 'SELECT R.ID, R.Template, R.WEDate FROM R WHERE (R.Template Like \"slow\")'
Is there a way to fix this.
Consider both of #joran's suggestions with single quote enclosing string literals AND using the ANSI-92 wildcard operator %. You would use asterisk, * (ANSI-89 mode) when running an internal query, namely inside the MSAccess.exe GUI program (which defaults to DAO) or if you connect externally to Access with DAO. Meanwhile, ADO connections uses the percent symbol which most external interfaces uses including RODBC.
I was able to reproduce your issue and both these remedies worked. Also, no need to use paste() as you are not concatenating any other object to query statement.
library(RODBC);
channel = odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};
DBQ=C:/Users/ADMIN/Documents/R.accdb")
test = sqlQuery(channel,
"SELECT R.ID, R.Template, R.WEDate FROM R WHERE R.Template Like '%slow%'")

Excel data not visible in analytics obiee

I have created a system DSN with oracle BI server driver adding a excel as source data. I was able to create a RPD. Once I logged in to analytic I was able to see the RPD in analysis. But if I select any column and check for the result I get an error like mentioned below. Please help me sort out this issue.
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 16001] ODBC error state: IM002 code: 0 message: [DataDirect][ODBC lib] Data source name not found and no default driver specified. (HY000)
SQL Issued: SELECT 0 s_0, "New"."Sample"."Customer Name" s_1 FROM "New" FETCH FIRST 65001 ROWS ONLY

Resources