Turn a column of amounts into a clear shape. Three small traps decide whether your bucket counts are true: empty buckets, uneven ranges and BETWEEN.
Checking IDENTITY Columns Before They Run Out of Numbers
Check IDENTITY columns for their current value, type limit and remaining range, including descending increments, before inserts fail.
Assigning Rows Round-Robin to Workers With ROW_NUMBER
Number the tasks, number the workers, match them with a remainder. A fair queue in one query, and the two shortcuts that quietly break it.
Reviewing a Table Change Script Before It Locks Production
Review a table change script for schema locks, data rewrites, supported online options, backfill batches, and a tested rollback.
SQL SERVER – Find Current Location of Data and Log File of All the Database
A one line query on sys.master_files that shows the current data and log file location for all databases, handy when cleaning up old .mdf and .ldf files.
SQL SERVER – List All Server Wide Configurations Values
I forgot the syntax to check the two digit year cutoff, so I listed all Server Wide Configurations with sys.configurations. A small script worth saving.
SQL SERVER – Reasons to Backup Master Database – Why Should Master Database Backedup
Why should you backup master database? It holds all logins, system configuration and the details SQL Server needs to reach every other database.
SQL SERVER – Restore Master Database – An Easy Solution
A two step easy way to restore master database: start SQL Server in single user mode, then restore from a full backup of master. No full backup, no restore.
SQL SERVER – Simple Example of Reading XML File Using T-SQL
A simple example of reading XML file content using T-SQL: load the XML into a variable and pull out elements and attributes with value() in a SELECT.
SQL SERVER – Simple Example of Creating XML File Using T-SQL
I always want to learn SQL Server and XML file. Let us go over a very simple example, today about how to create XML using SQL Server.










