Good DBAs automate the boring work. Here is a simple script to run Backup and Restore of a database from the command prompt with SQLCMD.
Generate Random Values in SQL Server: SQL in Sixty Seconds #042
To generate random values in SQL Server, pick the function by the job: RAND for one value, CHECKSUM(NEWID()) for a value on every row, CRYPT_GEN_RANDOM for tokens. The tests here count 100,000 draws and show where the common formulas go wrong.
TRIM Function in SQL Server: SQL in Sixty Seconds #040
The TRIM function removes spaces from the ends of a string, and SQL Server has had it since 2017. The tests here show which characters TRIM leaves behind, the LEADING and TRAILING keywords, and a WHERE clause that read 884 pages against 3.
Configure Database Mail in SQL Server: SQL in Sixty Seconds #039
To configure Database Mail, you need an SMTP account, a profile and permission to use it. The tests here build all three with T-SQL on SQL Server 2025, show the exact errors for missing access, and follow a failed send through the mail log.
Wrap SQL Code in SSMS: SQL in Sixty Seconds #038
You can wrap SQL code in SSMS so long lines fit the window and you never scroll sideways. This post gives the exact menu path, what each option on that page does, a long query to test it with and a shortcut for switching it on and off.
Delete Duplicate Records in SQL Server: SQL in Sixty Seconds #036
To delete duplicate records safely, look at them first. The tests here find the duplicates, preview the rows that will go, delete all but the newest copy inside one transaction and add a unique index so they cannot return. Every query ran on SQL Server 2025.
Concat Strings in SQL Server: SQL in Sixty Seconds #035
To concat strings in SQL Server, use the + operator or the CONCAT function. The tests here show what each one does with NULL, numbers and dates, how the 8000 character limit cuts a result, and when CONCAT_WS or STRING_AGG is the better tool.







