set-based

Set based calculation for events table, exceptuating an event

Hello, I have a table which contains events for change the state of a maintenance service. This is a sample of data: id date event 234 2009-04-22 10:00:00 Service Request 234 2009-04-22 10:02:00 Service Approbation 234 2009-04-22 10:03:00 Service Asignation 234 2009-04-22 10:40:00 Service Fulfilled ... In a report, i need to show tim...

RBAR vs. Set based programming for SQL

Having read this link on RBAR and this, my understanding of RBAR amounts to this: Anything that have loops and cursors Anything that's not set based I know this sounds kinda wholly which is why I am asking if anyone has a more elegant explanation as to what set-based programming is (within SQL context). ...

MySql: Operate on Many Rows Using Long List of Composite PKs

What's a good way to work with many rows in MySql, given that I have a long list of keys in a client application that is connecting with ODBC? Note: my experience is largely SQL Server, so I know a bit, just not MySQL specifically. The task is to delete some rows from 9 tables, but I might have upwards of 5,000 key pairs. I started ou...

Use sum in update statement where criteria

I have been trying to search for this and am not sure I am using the correct terms. Or it might just be that it's not possible. But what I am trying to do is update all records in a table that make up a sum value that is less than a set value. So here is an example: ID type amount received_date processed_date 1 debit 10 ...

Set-based execution; SQL and .NET

In SQL, one should always strive for set-based operations versus iteration-based (i.e. looping). In .NET, we frequently loop collections and objects. Are there any commands in .NET that allow set-based processing or is everything iteration-based? (I'm reminded of how DataAdapter.Fill calls DataReader which iterates through each record in...