mssql-bulk-data-operations

Generates batched T-SQL scripts for large-scale MSSQL UPDATE, DELETE, and tracking-table insert operations.

2|1|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/cilerler/lillian --skill mssql-bulk-data-operations-cilerler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mssql-bulk-data-operations
Source: https://github.com/cilerler/lillian/tree/main/plugins/ai-toolkit/skills/mssql-bulk-data-operations
Command: npx skills add https://github.com/cilerler/lillian --skill mssql-bulk-data-operations-cilerler

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Updating or deleting millions of rows in a single MSSQL statement causes lock escalation, transaction log bloat, and long blocking operations. This Skill generates safe, resumable batched T-SQL scripts with progress tracking and checkpointing for large-scale data operations. ## Core Features & Use Cases - Three Operating Modes: Bulk insert into a tracking table, batched UPDATE, and batched DELETE, all driven by a BulkProcessTracking schema with IsProcessed flags for resumability. - Production Safety Controls: Batch sizes capped at 4,500 rows, ROWLOCK/UPDLOCK hints, WAITFOR DELAY throttling, and conditional CHECKPOINT for SIMPLE recovery models. - Progress Reporting & Recovery: Real-time RAISERROR progress messages, keyset cursor pagination safe at BIGINT maxima, and transaction-scoped claim logic so interrupted runs resume cleanly. - Use Case: You need to set IsVerified = 1 on 3 million customer rows where SignupDate < '2025-01-01'. The Skill outputs a setup script, a tracking-table insert script, a batched update script, and a commented cleanup script. ## Quick Start Ask the AI to update 3 million records in dbo.Customer setting IsVerified = 1 where SignupDate is before 2025-01-01 using batched T-SQL scripts.

Frequently Asked Questions about mssql-bulk-data-operations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I update millions of rows in SQL Server without locking the table?

Process the rows in batches of 4,500 or fewer using ROWLOCK and UPDLOCK hints, with a short WAITFOR DELAY between batches. This Skill generates scripts that stage target IDs in a tracking table and update them in resumable batches to avoid lock escalation.

How to batch delete large numbers of records in MSSQL?

Stage the target row IDs in a tracking table first, then delete in batches by joining the source table to a claimed in-progress set inside one transaction. The generated delete script adapts the update template by replacing the UPDATE statement with a batched DELETE.

What batch size should I use for bulk updates in SQL Server?

Use 2,000-4,500 rows for tables under 1M rows, 1,000-4,500 for 1M-10M rows, and 500-2,500 for over 10M rows. Reduce batch size further for wide tables, many indexes, heavy concurrent load, or Azure SQL DTU limits.

Does this batching approach support non-integer primary keys?

No, the templates support only integral INT or BIGINT key columns because they rely on keyset cursor arithmetic. For GUID or other key types, a different type-safe keyset implementation must be designed and reviewed instead.

Can an interrupted bulk update be resumed safely?

Yes, the tracking table uses an IsProcessed flag and claims rows inside a transaction, so rerunning the script continues from unprocessed rows. Any target DML failure rolls back the claim and target change together, preserving retry safety.

Why is CHECKPOINT disabled on Azure SQL in the generated scripts?

CHECKPOINT only reduces transaction log growth under the SIMPLE recovery model and is not applicable to Azure SQL Database or Managed Instance. The scripts detect the recovery model and engine edition at runtime and enable CHECKPOINT only when beneficial.