Results for “Tables & list numbering”
Small, practical examples. Search by task or narrow things down below.
Add days to a date
Use DATEADD for date arithmetic.
DATEADD✓ Tested
Append an item to a small array
PowerShell: The plus-equals operator builds a new array; use a generic list for repeated large additions.
PowerShell✓ Tested
Assign a rank within each group
Number rows with a partitioned window.
ROW_NUMBER✓ Tested
Avoid a shared mutable default argument
Python: Create a fresh list inside the function when the optional argument is omitted.
Python✓ Tested
Await several independent results
Preserve input order while awaiting multiple promises.
Promise.all✓ Tested
Capture a successful child-process result
Python: Run an argument list without a shell and check the return code.
Python✓ Tested
Catch a T-SQL error
Handle an expected conversion error in TRY/CATCH.
TRY CATCH✓ Tested
Compute a generated column
Store inputs and derive a value from them.
generated column✓ Tested
Convert text without raising a conversion error
Return NULL when a numeric conversion fails.
TRY_CONVERT✓ Tested
Copy nested mutable data independently
Python: Use deepcopy when changes to nested lists must not affect the original object.
Python✓ Tested
Copy selected rows into another table
SQL: INSERT SELECT performs a set-based copy with an explicit destination column list.
SQL✓ Tested
Copy selected rows into another table
SQL Server: INSERT SELECT performs a set-based copy with an explicit destination column list.
SQL Server✓ Tested