I have a SQL Server file with 50,000 update queries like this:
UPDATE [dbo].[TABLE1] SET [COLUMN2] = 'abc123' WHERE [Id] = 100;
UPDATE [dbo].[TABLE1] SET [COLUMN2] = 'def456' WHERE [Id] = 101;
UPDATE [dbo].[TABLE1] SET [COLUMN2] = 'ghi789' WHERE [Id] = 205;
UPDATE [dbo].[TABLE1] SET [COLUMN2] = 'jkl012' WHERE [Id] = 216;
UPDATE [dbo].[TABLE1] SET [COLUMN2] = 'mno345' WHERE [Id] = 350;
I don't want to run this file and execute all 50,000 queries at once. What is the best way to do this by executing 1000 queries at a time, and when these are done move on to the next 1000 until all are executed? Also If I get an error how would I do a rollback?