FIND YOUR NEXT FEW LINES
Results for “SQL Server”
Small, practical examples. Search by task or narrow things down below.
502 snippets foundClear filters
Add days to a date
Use DATEADD for date arithmetic.
DATEADD✓ Tested
Assign a rank within each group
Number rows with a partitioned window.
ROW_NUMBER✓ Tested
Calculate a value with SELECT
Postgres: Evaluate a small arithmetic expression on the database server.
Postgres✓ Tested
Convert text without raising a conversion error
Return NULL when a numeric conversion fails.
TRY_CONVERT✓ Tested
Count day boundaries between dates
Compare date values with DATEDIFF.
DATEDIFF✓ Tested
Find the final day of a month
Use EOMONTH without manually calculating month length.
EOMONTH✓ Tested
Generate a bounded sequence recursively
Use a recursive CTE with a recursion limit.
recursive CTE✓ Tested
Join rows in a chosen order
Aggregate text with STRING_AGG and WITHIN GROUP.
STRING_AGG✓ Tested
Page an ordered result
Skip rows and fetch a bounded page.
OFFSET✓ Tested
Read a scalar JSON property
Extract a named value using a JSON path.
JSON_VALUE✓ Tested
Read values generated by INSERT
Capture an IDENTITY value with OUTPUT.
OUTPUT✓ Tested
Roll back a trial update
Group a change in a transaction and undo it.
transaction✓ Tested