Update a group of records inside stored proc

Last Post 07 Nov 2011 07:42 AM by dbandee. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
kjmcsd
New Member
New Member

--
14 Apr 2010 05:47 AM
I am confused about how to update a group of records with SQL inside a stored proc.

Let's say I have 3 columns.

ID int

Name varchar(100)

Confirm bit



I want to update the confirm column for 10 names with one call to the stored proc. How do I do it? What do I need to pass to the stored proc?

rm
New Member
New Member

--
15 Apr 2010 03:49 AM
Update 10 rows with same name or each row has different name?
kjmcsd
New Member
New Member

--
15 Apr 2010 04:24 AM
Each row has a different name.
dbandee
New Member
New Member

--
07 Nov 2011 07:42 AM
i am not sure i understand exactly what is that you are trying to do
but i would have temp table variable in the proc with select top 10 records
and then match it back to your main table and do the update

you can get fancy and pass that 10 number into the proc and have TOP clause dynamic
So you can call execute usp_UpdateConfirm @NumberOfRowsToUpdate = 10

hope this helps
You are not authorized to post a reply.

Acceptable Use Policy