Passing parameters through Excel to an Informix DB works through MS Query but fails when returned to Excel due to General Error - sql

I require to query an informix database using parameters and Excel. When the query is executed in Microsoft Query the dataset is fetched and returned succesfully, when I attempt to return to Excel the following error occurs:
> [Informix][Informix ODBC Driver]General Error.
The query is as follows:
SELECT DISTINCT t1.r1, t1.r2, t2.r3, t2.r4
FROM informix.t1, informix.t2
WHERE t1.r1 = t2.r5 AND ((t2.r3=?) AND (t2.r4 =?))
Hope you can help as I'm new to this.
Thanks in advance

Related

executing sql query in UiPath to extract data from snowflake

I am using execute query activity in Uipath studio and writing the sql query like this
"select * from SNOWFLAKE_SAMPLE_DATA where value=CALL_CENTER"
to extract the table values from snowflake.
where "SNOWFLAKE_SAMPLE_DATA" is the database and "CALL_CENTER" is the table which is present in the said database.
After I execute the query in uipath it gives the following error:
Execute Query: ERROR [42S02] SQL compilation error: Object
'SNOWFLAKE_SAMPLE_DATA' does not exist or not authorized.
Any help in this regard will be highly appreciated.
Thank You
You will need to update your SQL query.
The correct syntax is SELECT * FROM [database.table];
If you want to pull everything from the table, you will need to enter the line below (in double quotes) in the Sql property of the Execute Query activity:
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.CALL_CENTER;
Lastly, the output will need to go to a data table.

I'm having a mismatch error when calling Round() in an SQL query

I have a simple Access 2007 database and when I run any of those sql queries
SELECT Round(CDbl(15.243),2)
Or
SELECT Round(15.243,2)
I'm having a type mismatch error in the criteria expression
This also doesn't work
SELECT Round(15,0)
Do you have any clue?
Thanks a lot

RODBC - Passing a data table filter for sqlQuery

I have looked at the following thread and its related links for RODBC help when it comes to passing an argument to sqlQuery: Pass R variable to RODBC's sqlQuery with multiple entries?
I have a function that takes in a year argument as a data table and the function will run smoothly when only one year is used as a filter but not if multiple years are inputted.
What's weird is that the function ran on my PC smoothly using multiple year filter before but now I'm getting the following error when I run it now:
42S02 208 [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'Output'.[RODBC] ERROR: Could not SQLExecDirect 'select * from ##Output'
I have all of my ODBC set up correctly, I think, that's why it runs when sqlQuery is only filtered with one year.
If someone could explain to me any possible reason why the function is not running on a multiple year argument would be great.

Can ASP's objConn.execute handle a SQL query that uses the subquery factoring with clause?

I have a long SQL statement that's essentially:
with a as (select * from t1),
b as (select * from a, t2 where a.id=t2.id)
select * from b
This statement executes perfectly fine in my TOAD application. But, when I try to stuff the above into a string variable and run it in ASP using:
set rs = objConn.execute(strSQL)
I get the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00942: table or view does not exist
/Application/xxxxx/yyyyy/myfilename.asp, line 168
Line 168 is the set rs = objConn.execute(strSQL) line.
I've used these same tables to run several other queries and posting them online using the set rs = objConn.execute(strSQL) line with no problem. The only thing I can determine is different with this SQL query is the subquery factoring.
I tried wrapping the whole query up in it's own select statement like:
select * from (with a as blah blah... entire original query)
But that still throws the same error. Can I just not use set
rs = objConn.execute(strSQL)
in conjunction with subquery factoring? Is that not supported? Or is there some kind of work around? Or could it be something else entirely?
Thanks.
I'm stupid. Wrapping select * from () around the whole block does indeed work. My error was being thrown because I forgot I was trying to join into an old (rarely used anymore) table that was actually in a different schema that I wasn't connected to. I solved the problem by rewriting the query to pull some of the needed data from that obscure table to a different table that I was connected to and contained the same data I needed.
The Microsoft OLE DB Provider for ODBC Driver is very old. It was created when Oracle 7 was around and has not really been updated since. The WITH clause was added with Oracle 9.2.
I am surprised your select * from () workaround does not work. It is exactly what we are using and it is working fine for us.
Another solution is to use the Oracle Provider for OLE DB instead of the Microsoft driver. It is provided by Oracle and is updated with every Oracle release.

MS Access database: Select statement error

I am trying following query in MS Access 2010 database:
Query:
SELECT ID, Title, Priority, Workflow_Instance_Step_ID:ID
FROM Task
Error:
Error Source: Microsoft Office Access Database Engine
Error Message: Syntax error (missing operator) in query expression 'Workflow_Instance_Step_ID:ID'
I know that field "Workflow_Instance_Step_ID:ID" is giving error as it has ':' operator, but I cant change it as it it coming from share point list.
I have tried '[Workflow_Instance_Step_ID:ID]' but still its giving an error.
Please give me your suggestion on the same.
I am unable to recreate your issue, at least with a native Access table in Access 2010. I created a table named [baz] with a single text field named [foo:bar]
foo:bar
-------
this
is
a
test
and the query
SELECT [foo:bar] FROM baz;
works fine, so a field name containing a colon character does not seem to cause problems for Access SQL as such.
An ODBC linked table to a SQL Server table with the same structure does not cause problems either.
In both cases the queries were run from within Access 2010 itself.
So we might be in diagnosis mode, so lets try
SELECT * FROM Task
and then look at the FieldNames that come back.