Since I've worked on both, I can give you some very good tips...
Step 1. Relax... SQL Server doesn't require things like Reference Cursors to return a result set. A simple SELECT will do it.
Step 2A. Forget everything you know about Cursors and While Loops. 99.9% of everything that can be done, can be done without either and will run MUCH faster in the process.
Step 2B. Make a mental paradigm shift (like my signature line says below)... stop thinking about what you want to do to a row and start thinking about what you want to do to a column.
Step 3. Break out Books OnLine (the help system in SQL Server). Read about every function and read about the double FROM clauses in UPDATE... they will save your bacon. Forget about using correlated subqueries in UPDATE and learn that UPDATE and SELECT can use the same kinds of joins.
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
How to post code problemsHow to post performance problemsForum FAQs