I am trying to update a table using table type parameter. Currently I am using the below query. But I would like to perform update in batches having batch size as one of the parameters. Kindly help.
ALTER PROCEDURE UPDATEStatus
@Ids int ,
@numbers TypeofNumbers readonly,
@Status char(2),
@nname varchar(50),
AS
BEGIN
BEGIN TRY
update e
set
e.status = @Status,
e.user =@nname,
e.time = GETDATE()
from detailtable e
join @numbers en on en.ID =e.ID
where e.oddIDs = @Ids
I tried to do in a single update but I wanted to do in sets or batches one by one. say 100 records first and then next 100 records until all are done
You can use something like this to do your update in batches:
Next time please also provide scripts for the DDL and some testdata.