Tag
#sql-server
4 patterns, 11 snippets, 7 tools, 1 AI guide and 3 experiments.
- Tool Foreign Key Diagram from SQL Server Paste the results of a query against sys.foreign_keys and get a diagram of your tables and how they relate, with every column if you want them. Export as SVG, PNG or Mermaid.
- Experiment How a Database Index Works: A B-Tree in 3D Watch SQL Server find customers by ID and by surname, page by page. An interactive Three.js model of a table, an index, key lookups and page splits.
- Experiment How SQL Server Joins Tables: Nested Loops, Hash and Merge, Side by Side Watch SQL Server's three join algorithms join the same rows at the same time, then see which one does the least work at real table sizes, and why.
- Experiment How to Read a SQL Server Execution Plan, in 3D An interactive 3D execution plan viewer. See where a query's cost goes, why a scan, a key lookup or a bad estimate slows it down, or paste your own plan.
- AI guide Letting an LLM Write SQL Against Production, Safely How to let an AI assistant or agent query a live SQL Server database without risking the data: a read-only login it can't escape, limits on what reads cost, and a reviewed, reversible path for changes.
- Snippet SQL Server: Convert Between XML and JSON Turn XML into JSON with nodes() and FOR JSON, and JSON into XML with OPENJSON and FOR XML PATH, keeping nested rows nested.
- Snippet SQL Server: Query Large XML Documents Without Timeouts Why shredding a big XML file with nodes() can take minutes, and the fixes that bring it back to seconds: no parent axis, full paths, text(), shredding once.
- Snippet SQL Server: Turn XML Into Rows with nodes() Shred an XML document into rows and typed columns with nodes() and value(), including child rows, attributes and namespaces.
- Tool XML to JSON Converter Convert XML to JSON and JSON back to XML, with attributes, repeated elements and namespaces handled the same way in both directions.
- Tool XML to nodes() Query Generator Paste a sample XML document and get a SQL Server nodes()/value() query, with column types inferred from the data and child rows shredded with CROSS APPLY.
- Pattern Changing Large Volumes of Production Data Without an Outage Planning backfills and clean-ups that touch millions of rows while the system stays live.
- Pattern Designing Audit Trails That Help Investigation What to record about data changes, and how to store it so you can answer what happened when something goes wrong.
- Tool JSON to OPENJSON Generator Paste a sample JSON payload and get a SQL Server OPENJSON query with column types inferred from the data.
- Tool List to SQL Converter Turn a pasted list of ids, or ids and new values, into a #temp table, an IN list, or JSON for OPENJSON.
- Tool Reversible Data Fix Script Builder Generate a SQL Server data fix script for an update or a delete, with a preview, backup table, verification, and a ready-made rollback or restore.
- Snippet SQL Server: Find and Remove Duplicate Rows with ROW_NUMBER() Preview duplicate rows, keep one per group, and delete the rest safely.
- Snippet SQL Server: Pass a List of IDs Without Dynamic SQL Turn a comma-separated or JSON list into rows you can JOIN to, with no string concatenation or SQL injection risk.
- Snippet SQL Server: Record Changed Rows with OUTPUT INTO Capture before and after values of an UPDATE or DELETE in the same statement, so any data fix can be undone.
- Snippet SQL Server: Update or Delete Millions of Rows in Batches Change large volumes of data in small batches to avoid table locks, log growth and blocking.
- Pattern Stopping Duplicates at the Source Instead of Cleaning Them Up Where duplicate records come from, and how to design imports, constraints, and matching so they cannot be created.
- Tool Timestamp Converter for Integrations Convert between Unix timestamps, ISO 8601, .NET ticks, Microsoft JSON dates, HTTP dates, and SQL Server literals.
- Snippet SQL Server: Safe Bulk DELETE Using JOIN Delete rows using a JOIN with a preview step to avoid accidental data loss.
- Snippet SQL Server: Update Only When Values Change Avoid unnecessary writes and locking by updating rows only when values differ.
- Snippet SQL Server: UPSERT Without MERGE Insert new rows and update existing rows safely without using MERGE.
- Snippet SQL Server: Bulk Update with JOIN Update many rows from a supplied list of IDs + values using a temp table and JOIN. Ideal for data fixes.
- Pattern Designing a Reversible Data Fix in SQL Server A repeatable approach for production-safe updates with verification and rollback.