FIND YOUR NEXT FEW LINES

Results for “SQL Server”

Small, practical examples. Search by task or narrow things down below.

502 snippets foundClear filters
SQL ServerWindow analytics

Sum a row and its immediate predecessor

SQL Server: A ROWS frame counts physical ordered rows rather than all peers with the same sort value.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Treat an empty trimmed value as missing

SQL Server: NULLIF converts an empty string to NULL before a fallback is applied.

SQL Server✓ Tested
SQL ServerGetting Started

Turn a condition into a result label

SQL Server: Use CASE to describe stock availability for each row.

SQL Server✓ Tested
SQL ServerReporting & grouped calculations

Turn known group values into columns

SQL Server: Conditional aggregation gives a portable pivot when the category set is known.

SQL Server✓ Tested
SQL ServerSchema design & transactions

Undo a multi-row transfer atomically

SQL Server: The first transaction commits the fixtures. Rolling back the second transaction restores both sides of the attempted transfer.

SQL Server✓ Tested
SQL ServerSchema design & transactions

Undo only the work after a savepoint

SQL Server: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.

SQL Server✓ Tested
SQL ServerGetting Started

Update one row using its primary key

SQL Server: Use a precise WHERE condition to change only the intended row in a scratch table.

SQL Server✓ Tested
SQL ServerBulk changes & set operations

Update rows selected by a related table

SQL Server: Use EXISTS to limit updates based on an independent eligibility table.

SQL Server✓ Tested
SQL ServerBulk changes & set operations

Update several classifications in one statement

SQL Server: A CASE expression computes the new value for each row covered by the update predicate.

SQL Server✓ Tested
SQL ServerTransactions & tables

Catch a T-SQL error

Handle an expected conversion error in TRY/CATCH.

TRY CATCH✓ Tested
SQLGetting Started

Calculate a value with SELECT

SQL: Evaluate a small arithmetic expression on the database server.

SQL✓ Tested
SQLiteGetting Started

Calculate a value with SELECT

SQLite: Evaluate a small arithmetic expression on the database server.

SQLite✓ Tested