Skip to content

Tag: snowflake-cloud-data-platform

Call stored procedure in Snowflake query

I have a stored procedure, called SP_CALC_BUCKET, defined. I can call it like so: and this works, and returns the result I expect. However, if I try to call this stored procedure for each row returned from a SELECT statement: I get the following error: Unknown user-defined function SP_CALC_BUCKET Clearly, the Syntax is informing Snowflake that it should look for

dates from the DATEDIFF()

I am using the query in Snowflake: It gives me no. of days as: days start_date end_date 14 2022-09-03 2022-09-17 28 2022-08-19 2022-09-16 but I need to find the dates for the days instead of just the no. of days i.e I want to see those all 14 dates instead of just no. of days. can anyone help. Answer so

Right join to an incremental date table not working in SQL

I have two tables. The first is a date_incremental table just holing dates from 1900-01-01 to current in yyyy-mm-dd format. The second table has user behavior. Here are the tables in visual form: date_incremental The user table Now, I want to get a table output where no date gaps exist between the users purchases, i.e. display the history subsequently. If

String length mismatch not giving data in another column

I’ve a column location in my table. I’ve used it as a common column to join two tables 1.Factory 2.Inventory Like Factory.location = inventory.location But I’m having a problem.. For example Location in factory table just has 09 where inventory table has 009 doesn’t match but for three digit numbers it’s matching eg: 115 = 115, 999=999. But in the