Need a good approach for inserting/updating records
Posted on 2011-04-22
I'm currently using MS SQL Server 2005. Inside a stored proc, I will be using a Linked Server to pull data from a mysql db. Once I get the data I need to call one of two existing stored procs to update or insert a patient.
My question is what is the best way to do this as far as looping through the list of patients I get from the mysql db and calling the stored procs?
I always hear cursors are the wrong approach so what is a better way to do this? The one thing I need to do is after each stored proc call is to check the returned results and update a column in the original mysql table for that record. Does that regulate me to looping and doing one record at a time?
Is using a cursor the same as using a while loop?