End-User Documentation

Validate INSERT, UPDATE, DELETE, MERGE, and Stored Procedures

Validate INSERT, UPDATE, DELETE, MERGE, and Stored Procedures

Statement wrappers let QueryLens apply type-specific rules, so choosing the right wrapper improves the accuracy of diagnostics.

What Each Wrapper Adds

  • SqlInsert can surface column/value count mismatches and required-column failures.
  • SqlUpdate and SqlDelete can emit missing-WHERE warnings.
  • SqlMerge supports merge-specific structure validation.
  • SqlStoredProc enables stored-procedure existence checks when a schema snapshot is loaded.

Example

var insert = new SqlInsert("INSERT INTO dbo.orders (customer_id) VALUES (@CustomerId)");
var update = new SqlUpdate("UPDATE dbo.orders SET status = @Status");
var delete = new SqlDelete("DELETE FROM dbo.orders");
var merge = new SqlMerge("MERGE dbo.orders AS target USING dbo.order_stage AS source ON target.id = source.id WHEN MATCHED THEN UPDATE SET status = source.status;");
var proc = new SqlStoredProc("EXEC dbo.usp_sync_orders @BatchId = @BatchId");

Related