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 ServerGetting Started

Match a text prefix

SQL Server: Use a percent wildcard after a known prefix.

SQL Server✓ Tested
SQL ServerGetting Started

Match one value from a short list

SQL Server: Use IN for a set of allowed values.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Measure the length of ordinary text

SQL Server: Use the engine’s text-length function; this ASCII example has no trailing spaces.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Normalize ASCII text to lowercase

SQL Server: LOWER is useful for display normalization; indexed case-insensitive search depends on the database collation and schema.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Normalize ASCII text to uppercase

SQL Server: UPPER changes character case under the database’s text rules.

SQL Server✓ Tested
SQL ServerRelationships & missing data

Pair employees with their managers

SQL Server: Alias a table twice to represent two different roles in one relationship.

SQL Server✓ Tested
SQL ServerText cleanup & matching

Place missing values after known values portably

SQL Server: A CASE sort key controls NULL placement without relying on engine-specific defaults.

SQL Server✓ Tested
SQL ServerWindow analytics

Rank tied scores with competition gaps

SQL Server: RANK leaves a gap after tied rows, unlike DENSE_RANK.

SQL Server✓ Tested
SQL ServerWindow analytics

Rank tied scores without gaps

SQL Server: DENSE_RANK assigns equal ranks to ties and increments by one for the next distinct score.

SQL Server✓ Tested
SQL ServerSubqueries & ranked selection

Read a page after a known unique key

SQL Server: A keyset predicate avoids scanning and discarding an increasing offset on a suitable index.

SQL Server✓ Tested
SQL ServerGetting Started

Read named columns from a table

SQL Server: Choose the columns needed and request a deterministic row order.

SQL Server✓ Tested
SQL ServerWindow analytics

Read the last value of the complete partition

SQL Server: Specify an unbounded-following frame so LAST_VALUE does not stop at the current row.

SQL Server✓ Tested