How to fetch all active and inactive tasks in snowflake - sql

I need to fetch all active and inactive tasks in snowflake
I tried using task_history function..

I would use the task_versions view in account_usage:
https://docs.snowflake.com/en/sql-reference/account-usage/task_versions.html
This view is currently Public Preview, but should have what you are looking for.

Related

Writing to SQL table when Azure Log Analytics is getting a new row

Hello good people over the internet, I need your wisdom.
I want to write to SQL table some results from Azure Log Analytics, I couldn't find an answer but is there any option to trigger a function or a procedure when new row is written to the logs?
Also is there any filter option for example only row with a specific values will trigger that function/procedure?
Thanks a lot :)
I am not sure what you are trying to achieve but if you what something like DDL events captured. You can go to Log Analytics Workspace then Logs and write a KQL query to select data you need, and then create a new alert rule.
AzureDiagnostics //table where all audits are stored
| where Category == "SQLSecurityAuditEvents"
| where statement_s has "alter user" //SWAP STRING YOU WANT TO SEARCH IN STATEMENTS(QUERY)
| where statement_s !has "alter table" //SWAP STRING YOU DO NOT WANT TO SEARCH IN STATEMENTS(QUERY)
| where database_principal_name_s != "DB_USER" //EXCLUDE SINGLE USER

How to update multiple records data through alv reports in SAP ABAP?

How to update multiple records data through ALV REPORT IN SAP ABAP?
Use the Selected Lines, I used to do that task ... If you are going to update random fields, the easiest way to do this is to delete all the data in database and insert it with the new updates ..
for an other solution you need to use the gd-edit functions
You can use a Loop statement with your logic inside to change/update only certain values/fields.
try this....
Use for all entries in select statement and pass updated work area to FM reuse_alv_grid_display.

How can I schedule a script in BigQuery?

At last BigQuery supports using ; in the queries, so I can write more than one query in one "block", if I seperate them with semicolon.
If I run the code manually, it works. But I cannot schedule that.
When I want to schedule, I have two choices:
(New) Web UI: I must give a destination table. If I don't do it, I could not save the scheduled query. But all my queries are updates and inserts with different "destination tables". Like these:
UPDATE project.exampledataset.a
SET date = current_date()
WHEN TRUE
;
INSERT INTO project.otherdataset.b
SELECT c,d
FROM project.otherdataset.c
So I cannot even make a scheduling in the Web UI.
Classic UI: I tried this, because the official documentary states, that I should leave the "destination table" blank, and Classic UI allows it. I can setup the scheduling, but it doesn't run, when it should. I get the error message in email "Error status: Dataset specified in the query ('') is not consistent with Destination dataset 'exampledataset'."
AIK scripting (and using semicolon) is a very new feature in BigQuery, but I hope someone can help me.
Yes, I know that I could schedule every query one by one, but I would like to resolve it with one big script.
Looks like the scheduled query was defined earlier with destination dataset defined with APPEND/TRUNCATE type transaction. While updating the same scheduled query to a DML query, GUI doesn't show the dataset field / table name to update to NULL. Hence this error is coming considering the previously set dataset and table name in the scheduled query.
Hence the fix is to delete the scheduled query and create it from scratch with DML query option. It worked for me.
Scripting is supported in scheduled query now. However, scripting query, when being scheduled, doesn't support setting a destination table for now. You still need to use DDL/DML to make change to existing table.
E.g.:
CREATE OR REPLACE TABLE destinationTable AS
SELECT *
FROM sourceTable
WHERE date >= maxDate
As of 2022, the BQ Console UI will let you create a new scheduled query without a destination dataset, but it won't let you update a prior SELECT to use DDL/DML block syntax. However, you can use the BigQuery Data Transfer API to update the destinationDatasetId field, via transferconfigs/patch. Use transferconfigs/list to get the configId for a given scheduled query.
Note that you can either use the in-browser API Explorer, if you have the appropriate credentials, or write a programmatic solution. Also seems useful for setting/updating any other fields, including renaming scheduled queries.

Report that only displays employees directly reporting to the manager running the report

Hello I'm running Obi 11g and I'm creating a dashboard for managers and I'm having difficulty finding a way to create a report for the dashboard that shows only the employees directly reporting to the manager running the dashboard / report.
I've done a little research and I'm guessing this is going to be done by session variables? but i'm not sure how. If there was a way I can pull the executing user's username I could just say employee.username = session.username and then run the query accordingly but is there a way to this?
Any help would be appreciated greatly. Thanks.
This is Oracle. It offers a function named USER that returns ... well, current user. So, your query might utilize it as
where employee.username = user
Since this may be an Oracle product but not and Oracle database query, you will need sth more OBI-specific:
VALUEOF(NQ_SESSION.USER)
I found what I was looking for
SELECT fnd_global.user_name FROM DUAL
This posts the username instead of the schema.

Item in where query source

Hi I'm a newbie to the oracle apex and I'm trying to create a dynamic page that let the user (the logged one) see only "his" record I tried in the source query (P101_USERNAME is the username item on the login page)
select * from user u where u.username=v('P101_USERNAME')
And this
Select * from user u where u.username=:P101_USERNAME
But I got the no data found error I think I'm doing the things the wrong way.. So is there a way to create a page that let the user see only the record linked to his username(or primary key) and hide the other?
That username field is only relevant for the life of the login process.
Throughout the application you should refer to :APP_USER
See list of available substitution strings
https://docs.oracle.com/cd/E59726_01/doc.50/e39147/concept_sub.htm#BEIHCJBG
If you’re using APEX 5, you can now get the User from the APEX$SESSION application context. here
You also can use function APEX_APPLICATION.g_user here