Read the SQL Server error log for startup details and incident context, filter it with T-SQL, and cycle files without losing needed history.
SQL SERVER – UDF to Return a Calendar for Any Date for Any Year
Reader Dan Golden built on my weekly calendar function to create a UDF to return a calendar for any date for any year. I fixed a small first and last week bug.
Checking XACT_STATE Before COMMIT or ROLLBACK in a CATCH Block
XACT_STATE separates transaction validity from the decision to retain work. Two isolated examples show a doomed transaction and a committable one, both with deliberate errors. Clean up on the same connection and respect the caller’s transaction ownership.
Rolling Back a Cumulative Update Safely
Rolling Back a Cumulative Update needs backups, setup evidence, a tested uninstall path, and special care for databases changed after patching.
LOG With a Base: Make the Calculation Explicit
LOG with a base makes logarithm meaning explicit. Compare base two, base ten and the natural default using typed, positive inputs.
SQL SERVER – Get Current Database Name
Need the current database name in a script? SELECT DB_NAME() returns the name of the database you are running the query in. It is a one line answer.







