FIND YOUR NEXT FEW LINES

Results for “lcm”

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

128 snippets foundClear filters
SQL ServerWindow analytics

Calculate a cumulative integer percentage

SQL Server: Divide a running window sum by the complete total using a unique ordering key.

SQL Server✓ Tested
SQL ServerGetting Started

Calculate a total for each group

SQL Server: Group nonmissing categories and calculate separate totals.

SQL Server✓ Tested
SQL ServerGetting Started

Calculate a value with SELECT

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

SQL Server✓ Tested
SQL ServerReporting & grouped calculations

Calculate each group’s integer percentage of the total

SQL Server: Multiply before division and protect against a zero denominator.

SQL Server✓ Tested
SQL ServerReporting & grouped calculations

Calculate each group’s numeric spread

SQL Server: Subtract MIN from MAX to report the difference between extremes.

SQL Server✓ Tested
SQL ServerTransactions & tables

Catch a T-SQL error

Handle an expected conversion error in TRY/CATCH.

TRY CATCH✓ Tested
SQL ServerBulk changes & set operations

Combine results while retaining duplicates

SQL Server: UNION ALL does not spend work removing equal rows.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Combine text values with a separator

SQL Server: Use the concatenation operator supported by the selected SQL dialect.

SQL Server✓ Tested
SQL ServerSchema design & transactions

Commit multiple related changes together

SQL Server: The first transaction prepares the fixtures. The second commits both updates as one unit.

SQL Server✓ Tested
SQL ServerSubqueries & ranked selection

Compare a row with its own group average

SQL Server: A correlated aggregate computes a different comparison value for each group.

SQL Server✓ Tested
SQL ServerReporting & grouped calculations

Compute an integer weighted average

SQL Server: Multiply before summing and guard a zero total weight with NULLIF.

SQL Server✓ Tested
SQL ServerSelect & page

Convert text without raising a conversion error

Return NULL when a numeric conversion fails.

TRY_CONVERT✓ Tested