Skip to content
Advertisement

Tag: loops

PSQL stored procedures using arrays as parameter

I’m using PostgreSQL and currently creating a stored procedure to do some calculations. I’ve been searching all morning and reading the documentation, but either the functionality I want isn’t supported or I must’ve overlooked something. Basically, this is what I have: Basically what happens is that I calculate how often I need to make a travel to deliver something, which

Can’t execute a while clause in SQL Server with Dbeaver

I am trying to execute a loop while in Dbeaver with SQL Server, but the statement keeps loading and does not execute it. I just want to print the word ‘ok!’ 3 times. I’m not sure if it’s a loop problem, a Dbeaver problem, or another. Can anyone help please? My code: Screenshot from Dbeaver Answer @cnt never increments, so

While loop function union function end

I want to loop the code shown below. I would like to use the [getpublicholidays] function for a variable number of years and merge them (union). Unfortunately I don’t know how to use the function in a loop with union. Can someone help? Answer If you are looping for X years, each time you loop to a new year, you

SQL query with loop to collect 14 day averages

I am a python user, new to SQL. I am trying to make a new table that is the average of the “NumberValue” column between two dates from “RecordDate” column, and slide that date range so that the new table has columns “average” that is the average of “NumberValue” over the date range, “start_date” that is the beginning of the

Iterate through a list of servers in SQL Server

I have a script similar to below and get: Could not find server ‘@CURSERVER’ in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. I am trying to get SQL Server Agent jobs from all linked servers. I don’t think there is a problem with my linked

R : x comparison (1) is possible only for atomic and list types

I am using R. In a previous post (R: Loop Producing the Following Error: Argument 1 must have names), I learned how to make a function (“create_data”) for my code. Now, I am trying to modify this function. First, I create some data to be used for this example: Here is the modified version of the function: The error results

Advertisement