Questions tagged [set-based]

48 questions
0
votes
2 answers

convert if-else statement inside a cursor in a set-based approach

I have a script containing a cursor with if-else statement, but it takes too much times to browse the table. (a table with 79000 rows takes 1h). So i need to convert it in a set-based approach. The if statement is IF ( SELECT count…
Mentezza
  • 619
  • 5
  • 15
-1
votes
1 answer

How to find updates to the status and who made it

I am working with a large SQL table, 186 columns, 257899 rows, and counting. It gets added to every time something is changed in the main data. This is part of the shadow tables that allow us to see an audit history of what has happened to different…
Mike
  • 1,648
  • 1
  • 35
  • 64
-1
votes
2 answers

Query to find ranges of consecutive rows

I have file that contains a dump of a SQL table with 2 columns: int ID (auto increment identity field) and bit Flag. The flag = 0 means a record is good and the flag = 1 means a record is bad (contains an error). The goal is to find all blocks of…
sdoan_
  • 1
1 2 3
4