SQL Server Science
Technical Articles for the DBA / Developer
Home » t-sql » Page 2

A Better Cursor Pattern for SQL Server: Cursor Variables and @@CURSOR_ROWS

2026-06-02 · by Hannah Vernon · in t-sql

Replace the traditional WHILE @@FETCH_STATUS cursor loop with a cleaner pattern using cursor variables, STATIC cursors, and @@CURSOR_ROWS for more readable, less error-prone T-SQL.

Should I use (max) size for all my nvarchar/varchar columns?

2026-04-29 · by Hannah Vernon · in Internals, performance, t-sql

Should you use VARCHAR(MAX) for all your string columns? No. Here’s why MAX costs you indexing, memory grants, and storage efficiency with demos you can run yourself.

Teaching GitHub Copilot Your T-SQL Coding Standards

2026-04-01 · by Hannah Vernon · in t-sql, tools

If you’re a DBA or database developer using GitHub Copilot CLI, you’ve probably noticed it generates functional T-SQL — but not necessarily T-SQL that matches your team’s coding standards. After several weeks of working with…

Part 2: When the AI Code Reviewer Finds Bugs the Optimizer Didn’t

2026-03-20 · by Hannah Vernon · in DMVs, performance, t-sql

In Part 1, I walked through an interactive session with GitHub Copilot CLI where we optimized a production T-SQL function — cutting memory grants by 80% and logical reads by 73%. I thought we were…

Can GitHub Copilot Optimize Your T-SQL? I Put It to the Test

2026-03-20 · by Hannah Vernon · in DMVs, performance, t-sql

I’ve been curious about how well AI coding assistants handle real-world T-SQL optimization — not textbook examples, but production code with system DMVs, Availability Groups, and windowed functions. So I pointed GitHub Copilot CLI at…

Auditing DDL Events

2020-02-06 · by Hannah Vernon · in service broker, t-sql

SQL Server doesn’t audit DDL events out of the box, aside from several major events which are captured in the Default System Trace. By “audit”, I mean there is no log of the data-definition-language statements…

« Previous 1 2 3 4 Next »

Search

Categories

  • AI for DBAs
  • announcements
    • events
  • basics
    • localization
  • configuration
  • Data Architecture
  • DMVs
  • documentation
  • extended-events
  • Git for DBAs
  • High Availability
  • Hot Takes
  • Internals
  • maintenance
    • patching
  • Opinion
  • performance
  • PostgreSQL
  • Professional Development
  • recovery
  • reporting
  • security
    • data security
  • service broker
  • SQL Server Agent
  • statistics
  • sys
  • t-sql
    • xml
  • tools
    • data masking
    • wsus
  • troubleshooting
  • Uncategorized

Pages

  • About SQL Server Science
  • Get Better Help with a Minimal, Complete, and Verifiable Example, or MCVE
  • Privacy Policy

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.

To find out more, including how to control cookies, see here: Cookie Policy

Copyright © 2026 SQL Server Science