executing sql query in UiPath to extract data from snowflake - sql

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.

Related

SQL (DB2) Creating table by selecting from other table

I´ve read several discussions and websites about creating a SQL query to create a table by selecting data from other table, but none of them solved my issue. I don´t know what else to do.
I am working on a SQL script to run a sequence of selects and creates do resume some data. I´ve been using this SQL queries on a SaS server using DB2 data. Now I need to migrate to Dbeaver to using other sources.
I just want to create a table by selecting some columns and data from other table, for this simple example :
"CREATE TABLE DB2XXXX.PaidResume AS
(SELECT HistoricalPaid.AccountNumber AS CONTA
FROM DB2XXX.HistPaid HistoricalPaid
WHERE HistoricalPaid.AccountNumber = 'XXXXX');
All I got it this error
Error occurred during SQL query execution
SQL Error [42601]: ILLEGAL SYMBOL "<END-OF-STATEMENT>". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.26
If I just exclude the "CREATE TABLE DB2XXXX.PaidResume AS" and run the select only, it works.
You must include WITH DATA or WITH NO DATA at the end of the SQL statement. For example:
create table u as (select a from t) with data;
See example at db<>fiddle.

SSIS save value as a parameter

I am using SELECT UpdateDate FROM dbo.log command in a execute sql task. I'm fairly new to this so please bear with me. I want to store the value as a variable then pass that into the where clause of a subsequent data flow. My questions are:
What is the correct way to setup the Execute SQL Task. In General I have the OLE DB Connection and direct input with the query above. Result Set is set to Single row and then I am storing this to a variable I have created called User:: UpdateDate. For some reason this doesn't work?
I then want to call this date in a data flow. ie. SELECT * FROM Users WHERE RecordDate > User::UpdateDate. I believe the syntax is different for this.
I would really appreciate some help with this. Many thanks in advance
In your Execute SQL Task Editor, configure the Parameter Mapping as shown below, obviously use your own variable, in this example I'm using PackageStartTime.
Then in your SQL statement, use below:
SELECT * FROM Users WHERE RecordDate > ?
To save value from a SQL Statement, you will need to set the Result Set to single row and configure result set as shown in the example below:
Execute SQL Task with ResultSet
First of all, create a variable of type System.Date example: #[User::UpdateDate].
Add an Execute SQL Task select the OLEDB connection and use the following command as SQL Statement:
SELECT TOP 1 UpdateDate FROM dbo.log
Set the ResultSet property to Single Row and in the ResultSet Tab add a Row with the following values:
ResultName = 0 (which means the first column)
VariableName = #[User::UpdateDate]
Additional Information
SSIS Basics: Using the Execute SQL Task to Generate Result Sets
OLEDB Source with parameterized SQL Command
Inside the Data Flow Task, add an OLEDB Source, select the Access Mode to SQL Command. And write the following command:
SELECT * FROM Users WHERE RecordDate > ?
Click on the Parameters button and map the variable #[User::UpdateDate] as the first parameter.
Additional Information
Map Query Parameters to Variables in a Data Flow Component
Parameterized OLEDB source query

How to execute multiple Oracle sql queries from VBscript?

I have a database object called objdb. From this object it seems that I can only execute one sql query at a time. if I insert a semi-colon in the end,it gives me a
ORA-0911 invalid character error.
For example, if I run
objdb.executeSQl("select * from table1; select * from table2")
This gives me a error.
How can I run multiple queries from a single ExecuteSQl method ?

Writing SQL in Informatica Data Quality Analyst

I am new to Informatica Data Quality Analyst (Version 9.5.1 HotFix3) and I am having trouble in generating a basic SQL statement.
The SQL statement is being written against a mapping specification of a table that was originally imported as a flat file. The statement looks like:
Select ColumnA, ColumnB FROM Table1
WHERE Table1.ColumnA = 'S'
The SELECT .... FROM portion of the statement works fine but I encounter errors when I throw in the WHERE clause. I think my statement looks like standard SQL so I'm not sure why this will not work. Does Informatica Analyst accept SQL written only in a specific form? Are the inverted commas causing problems?
the query must work which you are trying to execute. If its not fetching the results, you need to do the following steps:
1) Load the data from source flat file to any database(oracle). You can directly import the data from flat file to table via sql developer.
2) Execute the query with the filter condition. If it doesnt fetch any rows, your query in idq is fetching correct results. If not, there is something missing in your idq code.

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

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