I'd like to know if this kind of stored procedure is possible, do i need some sort of looping structure or something? I want to do this, basically in this order:
- get all rows from one table or view. (table1)
- based on columns from table 1, i want to set variables for use in insert/update table2.
- i want to reference another table, (table3), to find a key from table1, that will "Override", any cases that the row data might fall into.
- Insert or Update the table2.
If this is possible, could i PLEASE get some sort of draft in the answer? Thank you for reading! plz try to help! Here's another sort-of "diagram" of what I'm thinking:
- select * from table1
- case [table1].[table1column] - [table1].[table1column] <=0, parameter1= "a" (many cases)
- case [table1].[tableID] Exists in table3, parameter1 = [table3].[parameter]
- case [table1].[tableID] Exists in table2, update, else insert
Thanks for all the attempts so far!!If i figure this out I'm gonna post it.