Questions tagged [set-based]

51 questions
0
votes
1 answer

Adding an array element to all documents in a collection

My Foo documents have a CustomData collection used to add user-configurable properties. Sometimes, when I create those properties, I'm need to add them with a default value for indexing purposes. This is what I'm trying to use for that…
Diego Mijelshon
  • 52,548
  • 16
  • 116
  • 154
0
votes
0 answers

Set Based Solution to call a stored procedure for each row in a view

I would like to call a stored procedure for each row returned in a database view and pass values from the row to the stored procedure. Note that the data within the view does NOT contain an ID column (or any unique column). I see that using cursors…
0
votes
2 answers

SQL: Failing to bring back effective begin/end dates on order by/partition by query

I want to bring back a result set that returns the beginning effective date and the end effective date for an id with multiple supplier changes. To do this, I am looking at a transaction table that records the id, the supplier's id and the date the…
plditallo
  • 701
  • 2
  • 13
  • 31
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
  • 627
  • 5
  • 16
-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,853
  • 3
  • 45
  • 75
-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